背景:用createprocess呼叫win32控制台程式,引數傳遞win32程式接受不到。
**:cstring strfullpath = _t(「d:\\test.exe」);
cstring strcmdline = _t(「param」);
startupinfo si = ;
process_information pi;
bool brunprogram = createprocess(strfullpath.getbuffer(), strcmdline.getbuffer(), null, null, false, 0, null, null, &si, &pi);
strfullpath.releasebuffer();
strcmdline.releasebuffer();
if (brunprogram)
錯誤原因:引數中少空格。
修改為cstring strcmdline = _t("");
strcmdline += _t(" ");//此處要新增空格
strcmdline += _t(「 param」);
引數傳遞成功。
CreateProcess引數傳遞
引數傳遞是很奇怪,有時候會無法啟動,比如 createprocess c a.exe aa bb cc 顯示出錯 通過createprocess c a.exe c a.exe c a.exe aa bb cc 即可.handle hread,hwrite security attributes s...
CreateProcess函式使用
startupinfo infostart process information infoprocess memset infostart,0,sizeof infostart infostart.cb sizeof startupinfo infostart.dwflags startf use...
CreateProcess 終止程序
最近需要用到,稍微研究了下。1.供createprocess啟動的程序test.exe,只是列印出引數而已。include stdafx.h include include include using namespace std int main int argc,char argv 程式 incl...