CreateProcess / GetExitCodeProcess cross-platform issues
Posted on 2000-03-20
I've written a program that executes a list of applications asychronously. These applications are both Windows- and DOS-based. To terminate these programs after they've finished I use GetExitCodeProcess and loop until the return isn't equal to STILL_ACTIVE. This method works for the DOS-based applications on the development platform (WinNT), but it doesn't work for the Windows-based applications. However, that isn't my problem. When I try to run my application on a Windows 95/98 machine, the above method doesn't work. In other words, all of the programs require the user to close them before the processing will continue.
I know if I add a "command.com /c " to the start of the string that is passed to CreateProcess it would solve my problems. But, it would also introduce another one since I'm executing both Windows and DOS applications. I also know that I could use SHGetFileInfo to determine the type of executable and add more code to fix the problems I would encounter. I'd prefer not to do it this way though.
My real question is this. How can I most easily determine if a DOS application has finished executing on both Windows NT and 95/98? What would be even better is if there were a way to determine if both DOS- and Windows-based applications have reached their end.