I have a C++ Windows program that produces a window and performs a GetMessage() loop to change that window upon a mouse/keyboard event or an event that a file has changed. It works great except when I bring up another window to change the file my program is waiting on -- to test it. When I change the file in another window, my program does not react to this until I move my mouse back over my program window (i.e., I don't even have to click on that window to make it the focus). Is there some parameter I can set to have my program react immediately to events even though I'm in another window?
I've included the message loop part of my C++ code to show my intention.
--Code:/* Main message loop - respond to either a mouse/keyboard event, or file change */ while (GetMessage(&msg, NULL, 0, 0)) { // get windows messages iRslt = checkFileChange (SPEECH_FILE); // iRslt =1 if SPEECH_FILE changed if (iRslt == 1) { // PostMessage( hWnd, WM_FILECHANGE, NULL, NULL ); // does nothing msg.message = WM_FILECHANGE; fprintf (fpOut, "MAIN LOOP: file change%d\n"); // for debugging } TranslateMessage(&msg); DispatchMessage(&msg); } CoUninitialize();




Reply With Quote
