Which message window receives after all when it open?
-
I ned to detect moment when all operation on Creation and Showing window is finished, and window ready to work and working ? Also what message window receives when othr window moves over it ? Thanks
vgrigor wrote: Creation and Showing window is finished, and window ready to work and working ? I dont think there is a any that kinda message, but there is a workaround for this... If i assume that you are talking about dialog window. You need to do the following steps. 1.Define a custom window
#define WM_MYMESSAGE WM_USER + 1
2.Then at the end of the OnInitDialog you post this message
PostMessage(WM_MYMESSAGE,0,0);
3. Add a message handler for the message in the message map.
...
ON_MESSAGE(WM_MYMESSAGE,OnMyMessage)
...4. Implement the function.
MSN Messenger. prakashnadar@msn.com "If history isn't good, just burn it." - Sidhuism.
-
I ned to detect moment when all operation on Creation and Showing window is finished, and window ready to work and working ? Also what message window receives when othr window moves over it ? Thanks
I had a similar problem when starting up a program (Acrobat Reader) and wanted to wait until it had finished convulsing before trying to diddle it. I stumbled upon
WaitForInputIdle()
. Here is a working example of using it:STARTUPINFO startupInfo; PROCESS_INFORMATION processInfo; ::ZeroMemory(&startupInfo, sizeof(startupInfo)); startupInfo.cb = sizeof(startupInfo); ::ZeroMemory(&processInfo, sizeof(processInfo)); char cmd[MAX_PATH + MAX_PATH + 5]; sprintf(cmd,"\"%s\" \"%s\"", szExe, pdfFile); BOOL startedOK = CreateProcess( NULL, cmd, // Complete command line, including quoting NULL, // Process security NULL, // Thread security FALSE, // Inheritance 0, // no special startup flags NULL, // no special environment NULL, // no default startup directory &startupInfo, &processInfo); // Get hProcess and dwProcessId from this if(!startedOK) { ShowLastError(cmd); return; } // Don't attempt to control the Acrobat Reader until it is ready **WaitForInputIdle(processInfo.hProcess,INFINITE);**
Of course, this is assuming the windows you're interested in are in another process... -
I ned to detect moment when all operation on Creation and Showing window is finished, and window ready to work and working ? Also what message window receives when othr window moves over it ? Thanks
-
I had a similar problem when starting up a program (Acrobat Reader) and wanted to wait until it had finished convulsing before trying to diddle it. I stumbled upon
WaitForInputIdle()
. Here is a working example of using it:STARTUPINFO startupInfo; PROCESS_INFORMATION processInfo; ::ZeroMemory(&startupInfo, sizeof(startupInfo)); startupInfo.cb = sizeof(startupInfo); ::ZeroMemory(&processInfo, sizeof(processInfo)); char cmd[MAX_PATH + MAX_PATH + 5]; sprintf(cmd,"\"%s\" \"%s\"", szExe, pdfFile); BOOL startedOK = CreateProcess( NULL, cmd, // Complete command line, including quoting NULL, // Process security NULL, // Thread security FALSE, // Inheritance 0, // no special startup flags NULL, // no special environment NULL, // no default startup directory &startupInfo, &processInfo); // Get hProcess and dwProcessId from this if(!startedOK) { ShowLastError(cmd); return; } // Don't attempt to control the Acrobat Reader until it is ready **WaitForInputIdle(processInfo.hProcess,INFINITE);**
Of course, this is assuming the windows you're interested in are in another process...