tkho@ucla.edu wrote:
- ok (CreateProcess(NULL, "notepad.exe", NULL, NULL, FALSE, 0, NULL, NULL,
&si, &pi),"CreateProcess error=%ld\n", GetLastError());- while (elapsed < timeout)
- {
Sleep(50);elapsed += 50;hNotepad = GetForegroundWindow();if (!hNotepad)continue;if (GetWindowText(hNotepad, wndTitle, 30) == 0)continue;if (strstr(wndTitle, "Notepad"))break;- }
WaitForInputIdle is supposed to be used instead of the while loop above.