Calling one exe from other
-
Dear All, I am developing an application in MFC VC++ Version 6.0 for Windows 2000. How can we can one exec from another exe. ie. want to call another exe on click of a button. Is there any Shell level api available ??? (excluding WinExec) Feel free to ask any further queries in this regards, Thanks Rohit Dhamija
-
Dear All, I am developing an application in MFC VC++ Version 6.0 for Windows 2000. How can we can one exec from another exe. ie. want to call another exe on click of a button. Is there any Shell level api available ??? (excluding WinExec) Feel free to ask any further queries in this regards, Thanks Rohit Dhamija
If you mean to start another program when you click a button, then you use the CreateProcess API. If you really must use the Shell API, then its ShellExecuteEx you will need. But I would recommend that you use CreateProcess. Magnus
-
If you mean to start another program when you click a button, then you use the CreateProcess API. If you really must use the Shell API, then its ShellExecuteEx you will need. But I would recommend that you use CreateProcess. Magnus
Is it possible to detect whether the process has finished with either of these API's (CreateProcess / ShellExecute) ?
If you can keep you head when all about you Are losing theirs and blaming it on you; If you can dream - and not make dreams your master; If you can think - and not make thoughts you aim; Yours is the Earth and everything that's in it. Rudyard Kipling
-
Is it possible to detect whether the process has finished with either of these API's (CreateProcess / ShellExecute) ?
If you can keep you head when all about you Are losing theirs and blaming it on you; If you can dream - and not make dreams your master; If you can think - and not make thoughts you aim; Yours is the Earth and everything that's in it. Rudyard Kipling
Andrew Walker wrote: Is it possible to detect whether the process has finished with either of these API's (CreateProcess / ShellExecute) ? Those APIs return immediately and don't block. If you want to block till the spawned app exits, see this article :- http://www.codeproject.com/system/newbiespawn.asp[^] Nish
Extending MFC Applications with the .NET Framework [NW] (coming soon...) Summer Love and Some more Cricket [NW] (My first novel) Shog's review of SLASMC [NW] Come with me if you want to live
-
Is it possible to detect whether the process has finished with either of these API's (CreateProcess / ShellExecute) ?
If you can keep you head when all about you Are losing theirs and blaming it on you; If you can dream - and not make dreams your master; If you can think - and not make thoughts you aim; Yours is the Earth and everything that's in it. Rudyard Kipling
-
Is it possible to detect whether the process has finished with either of these API's (CreateProcess / ShellExecute) ?
If you can keep you head when all about you Are losing theirs and blaming it on you; If you can dream - and not make dreams your master; If you can think - and not make thoughts you aim; Yours is the Earth and everything that's in it. Rudyard Kipling
You can use WaitForSingleObject on the handle that is returned in PROCESS_INFORMATION::hProcess. Or you can poll with GetExitCodeProcess Magnus
-
Andrew Walker wrote: Is it possible to detect whether the process has finished with either of these API's (CreateProcess / ShellExecute) ? Those APIs return immediately and don't block. If you want to block till the spawned app exits, see this article :- http://www.codeproject.com/system/newbiespawn.asp[^] Nish
Extending MFC Applications with the .NET Framework [NW] (coming soon...) Summer Love and Some more Cricket [NW] (My first novel) Shog's review of SLASMC [NW] Come with me if you want to live
Thanks Nish (& everyone else). That seemed to solve the prob
If you can keep you head when all about you Are losing theirs and blaming it on you; If you can dream - and not make dreams your master; If you can think - and not make thoughts you aim; Yours is the Earth and everything that's in it. Rudyard Kipling
-
Is it possible to detect whether the process has finished with either of these API's (CreateProcess / ShellExecute) ?
If you can keep you head when all about you Are losing theirs and blaming it on you; If you can dream - and not make dreams your master; If you can think - and not make thoughts you aim; Yours is the Earth and everything that's in it. Rudyard Kipling
_spawnl(_P_WAIT, "c:\\mydir\\my.exe", "c:\\mydir\\my.exe", "/s", NULL);
The program will not continue until my.exe has been closed. Check out this web site http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_crt__spawn.2c_._wspawn_Functions.asp?frame=true