Archived

This topic is now archived and is closed to further replies.

running a program inside a program

This topic is 5308 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

if you were going to just press a button and a program that is specafied would startup and run, what would be the code just run the program? Im running vc++. Easy way of programming: Code, Graphics, Swearing....

Share this post


Link to post
Share on other sites
Look up either ShellExecute() or system().

Actually, using system() is sorta cheating, but if you''re making a DOS app anyway, why not? A windows app will prolly want to use ShellExecute().

Share this post


Link to post
Share on other sites
ShellExecute is probably the simplest Windows way, but if you want more control (for example if you want to wait until the other program terminates before continuing) you can use the function CreateProcess.

Share this post


Link to post
Share on other sites
nvm I got the code for shellexacute
ShellExecute(handle, NULL, "C:/Program Files/Program.exe", NULL, NULL, SW_SHOWNORMAL);

but for some reason it dosn't like handle, it jsut gives me an error, its undeclared

Easy way of programming: Code, Graphics, Swearing....

[edited by - XDarkScar on June 4, 2003 1:29:44 PM]

Share this post


Link to post
Share on other sites
Try:

HANDLE handle = GetStdHandle(STD_OUTPUT_HANDLE);
ShellExecute(handle, NULL, "C:/Program Files/Program.exe", NULL, NULL, SW_SHOWNORMAL);


or I think it will work if the first parameter (handle) is null:

ShellExecute(NULL, NULL, "C:/Program Files/Program.exe", NULL, NULL, SW_SHOWNORMAL);

[ Google || Start Here || ACCU || MSDN || STL || GameCoding || BarrysWorld || E-Mail Me ]

[edited by - Lektrix on June 4, 2003 4:49:46 PM]

Share this post


Link to post
Share on other sites