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

How to open a program

Status
Not open for further replies.

kravfu

Programmer
Apr 28, 2004
2
US
I would like any info or a point in the right direction, on how to make a c++ program open another, like a text file or ms word.
any help would be appreciated.

thanx,
kravfu
 
try CreateProcess

Ion Filipski
1c.bmp
 
thanx Salem and Ion Filipski for the point in the right direction, yet now it's time to learn how those functions work by reading and stuff.

thanx,
kravfu
 
just use function system() to run a program or open a file. but make sure you specify the proper directory. Like:

system("c:\program files\c\c.exe");
 
Hey, use double backslashes \\ in C literal strings!..
Beware: system() function executes as synchroneous commnad, it will pause the application. Better follow Salem's/Ion's advices (use CreateProcess or ShellExecuteEx)...
 
If you want to pause while program lauched with CreateProcess runs, use WaitForSigleObject

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top