Archived

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

Using a program to run others

This topic is 5885 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

I was wondering how in the world would you get one program to run another. Like a front end for quake or gamespy for example, they are able to run other programs then shut itself down. I''m just wondering how you do the running other programs part. I''ve read and scan through many books and the closes i''ve ever gotten was loading and storing files. Can help me?

Share this post


Link to post
Share on other sites
Ok i was looking through msdn and look at it's structure. Pretty self explanatory, but one thing. I keep getting this error when i compile:

demo3_1.obj : error LNK2001: unresolved external symbol "struct HINSTANCE__ * __cdecl ShellExecute(struct HWND__ *,char const *,char const *,char const *,char const *,int)" (?ShellExecute@@YAPAUHINSTANCE__@@PAUHWND__@@PBD111H@Z)
Release/3_1.exe : fatal error LNK1120: 1 unresolved externals

My code is

ShellExecute(NULL, "open", "quake3.exe", NULL, "C:", SW_SHOWMAXIMIZED);

P.S.

I also get something about an unresolved externals when i try to use playsound in Lamothe's WGPG. I even try to compile his code and i get that error. Very strange.



Edited by - mack on November 3, 2001 1:55:52 AM

Share this post


Link to post
Share on other sites
The library doesnt show the requirements you need to use the function. Normally i see it says "header: time.h" and "library winmm.h" or something, but this function doesnt have it.

I got MSVC++ 6

Share this post


Link to post
Share on other sites
About to go crazy. No difference. If i include a prototype then it has the unresolve extrernal blah blah blah, but if i leave it out then i get an undeclared identifier. I think MY VC++ or my program is screwed. I might just reinstall it or make a bare bones program to test it later tonight. I got to get back to work in a couple so I can't do it now.

BTW the function looks like this in the library:


HINSTANCE ShellExecute(
HWND hwnd,
LPCTSTR lpOperation,
LPCTSTR lpFile,
LPCTSTR lpParameters,
LPCTSTR lpDirectory,
INT nShowCmd
);

be back in about 3 hours...



Edited by - mack on November 3, 2001 8:24:09 PM

Share this post


Link to post
Share on other sites
hmmm... dummy program to get ShellExecute is giving me a different unresolved crap again. oh well. I''ll just quit a while and maybe when i return I''ll figure it out.

Share this post


Link to post
Share on other sites
Haven''t you added a library before?

Go to Project->Settings. You''ll be seeing a dialog box and under the link tab add the libraries you need to the Object/ Libraries Modules: edit box.

Then build.

Share this post


Link to post
Share on other sites
Here is an easier way. Just include windows.h and do a WinExec("c:\\directory\\program.exe",1); . That works. Just dont forget your double back slash or it will not work, even you newbies should know that.

-----------------------------
http://www.hardwarenotes.com

Share this post


Link to post
Share on other sites
Oh and that number at then end can be used to manipulate the way the window appears i.e. minimized, full screen, normal. I dont remember which is which other than that 1 is normal. Just play with that a little and you can run programs minimized or make programs that are not usually allowed to be maximized to be maximized. Have fun.

-------------------------------
www.HardwareNotes.com

Share this post


Link to post
Share on other sites