[Dev-C++] Launching an application within a C++ code.
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: Asfe e <e_...@ho...> - 2004-01-27 03:19:27
|
Hi,
Im trying to run an application (could be any exe.) from within my code.
What is the best way to pass a string to cmdStr ? Can it be replaced?
Btw, anyone dealing with Unit testing ? Please write to me.
thanks,
Seth.
#include <windows.h>
#include <iostream.h>
void main(void)
{
CHAR cmdStr[100];
STARTUPINFO startUpInfo;
PROCESS_INFORMATION procInfo;
BOOL success;
GetStartupInfo(&startUpInfo);
success=CreateProcess(0,
cmdStr,
0,
0,
FALSE,
CREATE_NEW_CONSOLE,
0,
0,
&startUpInfo,
&procInfo);
if (!success)
cout << "Error opening wsImporter: "
<< GetLastError() << endl;
WaitForSingleObject(procInfo.hProcess,
INFINITE);
}
//Application paths:
//C:\Program Files\WinScribe\wsiauthor.exe for running Author
//C:\Program Files\WinScribe\Importer\wsImporter.exe for wsImporter Author
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online
http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963
|