Start the executable (EXE) program by entering the program location, using the Windows CreateProcess () function.
An example is the invocation of a pre-production executable (EXE) program.
Code:
* * * main.cpp * * Created on:2014.06.08 * author:spike//*vs 2012*/#include <iostre
Am> #include <windows.h> using namespace std; BOOL StartProcess (const std::string name_) {startupinfo si;//Parameter Settings memset (&si, 0, sizeof (STARTUPINFO)
);
SI.CB = sizeof (STARTUPINFO);
Si.dwflags = Startf_useshowwindow;
Si.wshowwindow = Sw_show; Process_information Pi;
The argument ends/*printf ("Please enter the name of process to start:");
std::string name; CIN >> name;*/if (! CreateProcess (null, (LPSTR) name_.c_str (), NULL, NULL, FALSE, 0,NULL,NULL,&SI,&PI)) {cout<< "Create error! "
<<endl;
return false; else {cout<< "Create sucess!"
<<endl;
return true;
int main () {const std::string name = ' D:/test/image.exe ';
if (!startprocess (name)) {cout << "Start Process error!" << Endl;
return 0; }
Note: Image.exe is a pre-production executable (EXE) program.
Author: csdn Blog spike_king
More Wonderful content: http://www.bianceng.cnhttp://www.bianceng.cn/Programming/cplus/