Quote Originally Posted by Daktor View Post
[...]have to figure out how long to wait before[...]
No sweat, by calling WaitForInputIdle function.
Then, as Victor already suggested, use the main process thread ID (returned in PROCESS_INFORMATION structure) to find the main window.