|
-
March 4th, 2004, 06:21 PM
#1
opening a exe file
How do you open a exe file programmaticaly?
My program is visual c++ mfc.
-
March 4th, 2004, 06:27 PM
#2
What do you mean by "opening" it?
Running it? If so, you can just include <cstdlib> and use the system() function to run it.
-
March 4th, 2004, 06:44 PM
#3
that doesnt work and yes how to run a exe.
-
March 4th, 2004, 06:53 PM
#4
There are some other functions like _spawnl, _spawnp... and _execv, _execve... Look in the MSDN.
Why system() doesn't work? Try to execute it in a separate thread(for example look _beginthread or (I'm not sure for MFC) afxBeginThread()) and may be will work.
Last edited by defiler_z; March 4th, 2004 at 06:56 PM.
-
March 4th, 2004, 07:05 PM
#5
Originally posted by immortal20
that doesnt work and yes how to run a exe.
system works fine, tell us what you did.
-
March 4th, 2004, 07:33 PM
#6
Try ShellExecute() or CreateProcess() ..
-
March 4th, 2004, 07:40 PM
#7
well i included the #include <cstdlib>
then i used this to run a exec
system("C:\\Documents and Settings\\BBY Tech\\Desktop\\Fixs DAP 1.0\\spybotsd12.exe");
and then a msdos window opens and closes right away.
-
March 4th, 2004, 07:53 PM
#8
Well what the program has to do? Because if it is something small it does it and terminate. If you have to enter some data it should stop and wait you to enter something. Otherwise this : system("C:\\Documents and Settings\\BBY Tech\\Desktop\\Fixs DAP 1.0\\spybotsd12.exe"); is correct.
-
March 4th, 2004, 07:57 PM
#9
well what i want it to do is when i click on this button it brings the spybot installation program.
-
March 4th, 2004, 07:59 PM
#10
ok i got it working, now is there a way to get rid of that msdos screen. it says C:\windows\system32\cmd.exe in the title bar.
-
March 4th, 2004, 08:10 PM
#11
Yes, use CreateProcess (assuming that the exe is not a console based exe of course).
-
March 4th, 2004, 08:28 PM
#12
wow there is alot of paremeters in there, can you give me and example in code on how to use all of those paremeters.
-
March 4th, 2004, 08:37 PM
#13
Okay, the last parameters are output structures. Create them and pass them in. Do NOT make them NULL.
The first parameter should be null (for the time being).
The second parameter is your command line.
Third and fourth parameters should be null (for the time being). Fifth parameter - FALSE.
Sixth parameter - NORMAL_PRIORITY_CLASS
Seventh paramter - NULL (for the time being)
Eighth parameter - NULL (for the time being)
Lookup MSDN if you would like to know what each parameter is/does.
-
March 4th, 2004, 08:40 PM
#14
CreateProcess(NULL,"C:\\spybotsd12.exe",NULL,NULL,FALSE,NORMAL_PRIORITY_CLASS,FALSE,NULL,NULL,NULL);
this is giving me an error when i run the program.
-
March 4th, 2004, 08:41 PM
#15
it dosent take 8 parematers
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|