|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
Stay one step ahead of the competition. Evaluate and give feedback
on some of the hottest web development tools on the market today.
Make your opinion heard! Click
Here
|
|
#1
|
||||
|
||||
|
Calling another program
Have a question...
How do you call another .exe from within a command line program so that I can pass it parameters? Eric |
|
#2
|
||||
|
||||
|
CreateProcess() ought to do it.
__________________
Jon Sagara "Me fail English? That's unpossible!" |
|
#3
|
|||
|
|||
|
you can use the imho easier function ShellExecute from shell32.dll.
the syntax (from the MS Windows SDK) is: Code:
HINSTANCE ShellExecute(
HWND hwnd, // handle to parent window
LPCTSTR lpOperation, // pointer to string that specifies operation to perform
LPCTSTR lpFile, // pointer to filename or folder name string
LPCTSTR lpParameters, // pointer to string that specifies executable-file parameters
LPCTSTR lpDirectory, // pointer to string that specifies default directory
INT nShowCmd // whether file is shown when opened
);
[edit] the only thing that was unclear to me first was "lpOperation" which should be "open" [/edit]
__________________
-- Manuel Hirsch - Linux, FreeBSD, programming, administration articles, tutorials and more. Last edited by M.Hirsch : November 8th, 2002 at 01:10 PM. |
|
#4
|
|||
|
|||
|
A portable solution would be to use popen, which allows complete command line option passing. It's generally part of stdio.h in modern compilers. As a bonus the input and output are available to the calling program.
If you want the program to present it's interface to the end user, the aforementioned CreateProcess is the way to go.
__________________
Clay Dowling Lazarus Notes Articles and commentary on web development http://www.lazarusid.com/notes/ |
|
#5
|
||||
|
||||
|
Thanks guys. I'll try to get working on these tonight if I can scrape time away from my daughter.
Eric |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > C Programming > Calling another program |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|