WaitForInputIdle parent process gets access exception
-
Hi I am waiting for a child process to complete initialization so that I can get its window handle After I do CreateProcess I use the PROCESS_INFORMATION pi parameter of The CreateProcess to WaitForInputIdle(pi.hProcess,INFINITE); The Child process goes about its business intitializing in InitInstance returns TRUE It has a message map After the return TRUE from InitInstance, the parent breaks from WaitForInputIdle with a Access Exception Thanks
-
Hi I am waiting for a child process to complete initialization so that I can get its window handle After I do CreateProcess I use the PROCESS_INFORMATION pi parameter of The CreateProcess to WaitForInputIdle(pi.hProcess,INFINITE); The Child process goes about its business intitializing in InitInstance returns TRUE It has a message map After the return TRUE from InitInstance, the parent breaks from WaitForInputIdle with a Access Exception Thanks
What you have detailed is correct and the recommended way to do it So you therefore have a coding error which can be (i) The launched process does not have a graphical interface ... must not be a console app which has no queue (ii) The createprocess startup structure is invalid If the launched process is yours you can go around the whole problem by using an Interprocess communication method. If the launched process isn't yours check your code with notepad or something simple which that technique works with.
In vino veritas
-
What you have detailed is correct and the recommended way to do it So you therefore have a coding error which can be (i) The launched process does not have a graphical interface ... must not be a console app which has no queue (ii) The createprocess startup structure is invalid If the launched process is yours you can go around the whole problem by using an Interprocess communication method. If the launched process isn't yours check your code with notepad or something simple which that technique works with.
In vino veritas
-
Thanks so much I see all of the info of the startup structure can be ignored can I memset The entire structure to NULLs
The .cb field is the only mandatory field which must be set to sizeof(STARTUPINFO); You can memset it and then set the .cb field but it's just as easy to zero the variable creation
STARTUPINFO startupInfo = {0};
startupInfo.cb = sizeof(startupInfo);your suggestion is fine as well
STARTUPINFO startupInfo;
memset(startupinfo, 0, sizeof(startupinfo));
startupInfo.cb = sizeof(startupInfo);In vino veritas
-
The .cb field is the only mandatory field which must be set to sizeof(STARTUPINFO); You can memset it and then set the .cb field but it's just as easy to zero the variable creation
STARTUPINFO startupInfo = {0};
startupInfo.cb = sizeof(startupInfo);your suggestion is fine as well
STARTUPINFO startupInfo;
memset(startupinfo, 0, sizeof(startupinfo));
startupInfo.cb = sizeof(startupInfo);In vino veritas