Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Calling external .exe through C++ v1.5.2

Status
Not open for further replies.

negronr

Programmer
Aug 19, 2002
5
US
Hello -

I need to call a .exe withing my C code. The .exe program will execute and once finish C should continue executing the rest of the C code.

Anybody have a good way to do this ?

Thanks...
 
There are a couple of ways: try looking up the [tt]ShellExecute()[/tt] and [tt]CreateProcess()[/tt] functions on MSDN. You can use these to launch other applications and open their files. For example, if you want to stick button on your about box that takes the user to your web site, you could use [tt]ShellExecute()[/tt] and pass in your web address URL as the argument - it will automatically open the user's default browser and navigate to your web site, eg:
Code:
ShellExecute(0,"open","http:\\\\[URL unfurl="true"]www.yourwebsite.com",[/URL]
		NULL,"http:\\\\[URL unfurl="true"]www.yourwebsite.com",0);[/URL]


[rockband]
tellis.gif

[sup]programmer (prog'ram'er), n A hot-headed, anorak wearing, pimple-faced computer geek.[/sup]​
 
When I try this a get the following error:

call.obj(call.c) : error L2029: '_ShellExecute' : unresolved external

any idea...
 
Ahhh, I just realized you're using a much older version of VC++!!! Although I thought this function had been around for time - perhaps you are missing an import library. I don't have a copy or ever used such an old version of VC++ so I can know for sure but it sounds like you are missing the import library for this function.
tellis.gif

[sup]programmer (prog'ram'er), n A hot-headed, anorak wearing, pimple-faced computer geek.[/sup]​
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top