Note that there are some explanatory texts on larger screens.

plurals
  1. POCan't switch keyboard language while window is active
    primarykey
    data
    text
    <p>I'm learning Win32 API. I've created an empty window and added an Edit box in it to type some text. I can type a text in it, but can't switch the keyboard language.</p> <p>Shortcuts like Alt+Shift don't work. If I click the language icon in the tray, it will pause for a few seconds, then it will open the list finally, but my window will become inactive, so the change won't affect it.</p> <p>I can make the language change happen if I do this:</p> <ol> <li>press Alt+Shift (or whatever the combination is)</li> <li>press Alt, Space</li> </ol> <p>Step 2 will result, as usual, in the popping of the window menu at the left top, but simultaneously the step 1 will become actual too.</p> <p>I guess, I'm not processing some kind of message, or creating the window wrong, but I can't find what is it that is wrong. Here is the full code:</p> <pre><code>#include &lt;windows.h&gt; // handle of the edit box HWND testEditBox; // shows a message void showMessage( LPSTR message ){ MessageBox( GetActiveWindow(), message, "", MB_OK ); } // a simple window procedure LRESULT CALLBACK windowProc( HWND window, UINT message, WPARAM wparam, LPARAM lparam ) { switch( message ) { case WM_CLOSE: DestroyWindow( window ); break; case WM_DESTROY: PostQuitMessage( 0 ); break; default: return DefWindowProc( window, message, wparam, lparam ); } return 0; } int WINAPI WinMain( HINSTANCE instance, HINSTANCE prevInstance, LPSTR commandLine, int showMode ) { // create window class WNDCLASS windowClass; windowClass.cbClsExtra = 0; windowClass.cbWndExtra = 0; windowClass.style = 0; windowClass.hInstance = instance; windowClass.hCursor = LoadCursor( NULL, IDC_ARROW ); windowClass.hbrBackground = (HBRUSH)(COLOR_BTNFACE + 1); windowClass.hIcon = LoadIcon( NULL, IDI_APPLICATION ); windowClass.lpszClassName = "testWindow"; windowClass.lpfnWndProc = windowProc; if( !RegisterClass( &amp;windowClass ) ) { showMessage( "Some trouble, sir" ); return GetLastError(); } HWND window = CreateWindow ( "testWindow", "Test Window", WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 400, 300, NULL, // no parent NULL, // no menu instance, NULL // no 'window-creation data' ); if( !window ){ showMessage( "Some trouble, sir" ); return GetLastError(); } ShowWindow( window, showMode ); // add an EDIT box to our window testEditBox = CreateWindow ( "EDIT", "input here", WS_CHILD, 10, 10, 200, 20, window, NULL, instance, NULL ); ShowWindow( testEditBox, SW_SHOW ); // start message loop MSG message; while( GetMessage( &amp;message, window, 0, 0 ) &gt; 0 ) { TranslateMessage( &amp;message ); DispatchMessage( &amp;message ); } return message.wParam; } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload