WaitForInputIdle doesn't work for starting mspaint programmatically
问题 I'm trying to open "mspaint" and find handle of it right after it has been initialized. But FindWindow returns NULL if I call WaitForInputIdle . If I try to use the function Sleep(1000) it works. But I don't think it's a right way to wait for the program to be ready. Is there a solution for this code? CString strWindowDirectory; GetSystemDirectory(strWindowDirectory.GetBuffer(MAX_PATH), MAX_PATH); SHELLEXECUTEINFO sei = { 0 }; sei.cbSize = sizeof(SHELLEXECUTEINFO); sei.fMask = SEE_MASK