Using a program to run others

Started by
12 comments, last by mack 22 years, 5 months ago
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?
Advertisement
In windows you''d use the ShellExecute function.

[Resist Windows XP''s Invasive Production Activation Technology!]
Thanks, you''ve just motiveated me to start practicing again. I stopped because i keep getting stuck.
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
You have not linked their libraries. Check the msdn for which libraries to link.
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
Shell32.lib
woew, one word, was he right? cuz I''m interested in this also =)
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
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.

This topic is closed to new replies.

Advertisement