Click to See Complete Forum and Search --> : executable
How to use this command :
WinExec()
or
ShellExecute()
or
CreateProcess()
I need to execute and esecutable program by un program (c:\projet.exe).
please help me .
killeras@club-internet.fr
Chao
May 5th, 1999, 08:19 PM
Hi,
you can run an exe file, or for that matter, open any file by using shellexec:
ShellExecute(NULL,"open",filename,parameters,default_path,SW_RESTORE);
parameters are arguments passed to the exe app
refer to msdn help on shellexec.
hope that helps
Chao
scp
May 6th, 1999, 10:59 AM
You can use CreateProcess as follows:
STARTUPINFO StartupInfo;
memset(&StartupInfo, 0, sizeof(StartupInfo));
StartupInfo.cb = sizeof(StartupInfo);
StartupInfo.lpReserved = NULL;
StartupInfo.dwFlags = STARTF_USESHOWWINDOW; // if you want to show the window
StartupInfo.wShowWindow = SW_SHOW; // if you want to show the window
StartupInfo.cbReserved2 = 0;
StartupInfo.lpReserved2 = NULL;
PROCESS_INFORMATION ProcessInformation;
// Suppose strExeName is the name of the exe (C:\project.exe)
// strCommandLine is the command line arguments string
// strWorkingDir is the working directory for the exe
BOOL bSuccess;
bSuccess = CreateProcess(strexeName, // pointer to name of executable module
(LPTSTR)(LPCTSTR)strCommandLine, // pointer to command line string
NULL, // process security attributes (cannot be inherited)
NULL, // thread security attributes (cannot be inherited)
TRUE, // handle inheritance flag
0, // creation flags
NULL, // pointer to new environment block
strWorkingDir, // pointer to current directory name
&StartupInfo, // pointer to STARTUPINFO
&ProcessInformation); // pointer to PROCESS_INFORMATION
Hope this helps...
Santhosh
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.