Re-incorporate the WaitForInputIdle() function, because MSDN says:
"For example, the parent process should use the WaitForInputIdle function before trying to find a window associated with the child process."
This commit is contained in:
parent
a9b787a740
commit
9fc973926a
15
src/head.c
15
src/head.c
@ -323,16 +323,21 @@ static BOOL signaled_or_failed(const DWORD wait_result)
|
|||||||
|
|
||||||
static BOOL wait_for_process_ready(const HWND hwnd, const HANDLE process_handle, const DWORD process_id)
|
static BOOL wait_for_process_ready(const HWND hwnd, const HANDLE process_handle, const DWORD process_id)
|
||||||
{
|
{
|
||||||
|
BOOL input_idle = FALSE;
|
||||||
const DWORD ticks_start = GetTickCount();
|
const DWORD ticks_start = GetTickCount();
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
const HWND child_hwnd = find_window_by_process_id(process_id);
|
if (input_idle || signaled_or_failed(WaitForInputIdle(process_handle, 125U)))
|
||||||
if (child_hwnd)
|
|
||||||
{
|
{
|
||||||
SwitchToThisWindow(child_hwnd, TRUE);
|
const HWND child_hwnd = find_window_by_process_id(process_id);
|
||||||
return TRUE;
|
if (child_hwnd)
|
||||||
|
{
|
||||||
|
SwitchToThisWindow(child_hwnd, TRUE);
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
input_idle = TRUE;
|
||||||
}
|
}
|
||||||
if (signaled_or_failed(WaitForSingleObject(process_handle, 13U)))
|
if (signaled_or_failed(WaitForSingleObject(process_handle, 1U)))
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user