Running on Windows 9.x I need to provide my user with the capability to execute a program of their choice when they hit the F10 key. It may be a Windows program, or a DOS program or a DOS batch file. They choose. I am using CreateProcess() to execute a command line that they provide.
My problem is that if it is a DOS program or batch file the DOS box stays open even after the program ends.
I know that:
1) Putting "Exit" as the last statement in a DOS batch file does NOT work, so please don't suggest that.
2) Using COMMAND.COM /c "user program.exe" supposedly works, but "user program.exe" may be a Windows program, so I can't do that either.
Certainly with all the options available in CreateProcess() there must be a way of closing the Window when the DOS program ends! Isn't there??
Or is there some ugly way (using GetProcessTimes() or something else) to decide that the program has ended and then kill it with TerminateProcess()?