Forums
| PVitt | Wed May 18 2011, 05:19am | |
| Registered Member #829 Joined: Tue May 17 2011, 07:41am Posts: 5
| Thanks. That was the error I made. Here is the code that works:
[DllImport( "user32.dll" )]
private static extern IntPtr GetForegroundWindow( );
[DllImport( "user32.dll", CharSet = CharSet.Auto )]
private static extern IntPtr SendMessage( IntPtr hWnd, UInt32 Msg, IntPtr wParam, IntPtr lParam );
private const Int32 WM_INPUTLANGCHANGEREQUEST = 0x0050;
private void ChangeKeyboardLayout( int keyboardLocale )
{
IntPtr hWnd = GetForegroundWindow( );
SendMessage( hWnd, WM_INPUTLANGCHANGEREQUEST, (IntPtr)0, (IntPtr)keyboardLocale );
}
| | Back to top | |
Powered by e107 Forum System
|