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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help with execute code

Status
Not open for further replies.

Guest_imported

New member
Jan 1, 1970
0
I want to launch a game from my application with a combo box, how would i do that? I made it where i can launch paint, but that was because it didn't have a dir. look

// Did the user select to run Paint
if (strPgmName == "PAINT")
// Yes, run the program Paint
WinExec("C:pbrush.exe", SW_SHOW);

It works, I don't get any errors if i use this but it doesn't launch the game.

// Did they choose Dh5
if (strPgmName == "DEER HUNTER 5")
// Yes, run the program Dh5
WinExec("C:program Files:Deer Hunter 5:Home:Deer Hunter 5.exe", SW_SHOW);

what do i do??

 
Ok, that first one didn't work with the C: before it

// Did the user select to run Paint
if (strPgmName == "PAINT")
// Yes, run the program Paint
WinExec("pbrush.exe", SW_SHOW);

it has to look like that......sorry

 
Try maybe using a few backslahes, like:

WinExec("C:\\Program Files\\Deer Hunter 5\\Home\\Deer Hunter 5.exe", SW_SHOW);

Using the ShellExecute() function rather than WinExec() is recommended under Win32.

:) Hope that this helped! :)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top