Hi,
I have searched the forums and across google, for code to simply lauch another exe.
Help appreciated
Hi,
I have searched the forums and across google, for code to simply lauch another exe.
Help appreciated
Last edited by jonezy; 06-19-2005 at 02:30 PM.
If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
If at first you don't succeed, try writing your phone number on the exam paper.
There's an entry in the FAQ (there's a "FAQ" button at the top of this page) that does exactly what you're looking for.
How do I run a program from within a program?
**Beaten by Salem.
Just Google It. √
(\ /)
( . .)
c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.
this should work , only need to add #include <windows.h> at beginning.
an exemple : Exec( "C:\\temp\\hello.exe" );Code:int Exec(char szPath[]) { PROCESS_INFORMATION pif; STARTUPINFO si; ZeroMemory(&si,sizeof(si)); si.cb = sizeof(si); BOOL bRet = CreateProcess(szPath,NULL,NULL,NULL,FALSE,0,NULL,NULL,&si,&pif); if (bRet == FALSE) { MessageBox(HWND_DESKTOP,"Unable to start program","",MB_OK); return 1; } CloseHandle(pif.hProcess); CloseHandle(pif.hThread); return 0; }
do not forget the double \ , or it's will not work.
thanks, slilly me lol the tutorials were the only places that i didnt check. The tutorials seemed very complex to look at so i am goin to try you reply wejav 2nite tand then i will get back to you.
I do not no y this code does not work.
any ideas??Code:#include <windows.h> int Exec(char szPath[]) { PROCESS_INFORMATION pif; STARTUPINFO si; ZeroMemory(&si,sizeof(si)); si.cb = sizeof(si); BOOL bRet = CreateProcess(szPath,NULL,NULL,NULL,FALSE,0,NULL,NULL,&si,&pif); if (bRet == FALSE) { MessageBox(HWND_DESKTOP,"Unable to start program","",MB_OK); return 1; } CloseHandle(pif.hProcess); CloseHandle(pif.hThread); return 0; } Exec( "C:\\Dev-Cpp\\madness2.exe" );
Try putting the Exec("C:\\ ... line inside main()...
Just Google It. √
(\ /)
( . .)
c(")(") This is bunny. Copy and paste bunny into your signature to help him gain world domination.
cant believe i missed that lol.
yep, that works now.
thanks for the help.