1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
|
void open(std::string address, Commander* c) {
LPWSTR wct=new wchar_t[address.length()+1];
std::copy(address.begin(), address.end(), wct);
wct[address.length()] =0;
ZeroMemory(&c->si, sizeof(c->si));
c->si.cb = sizeof(c->si);
ZeroMemory(&c->pi, sizeof(c->pi));
if (!CreateProcess(
wct,
NULL,
NULL,
NULL,
FALSE,
0,
NULL,
NULL,
&c->si,
&c->pi
)) {
std::cout << "open failed.\n";
}
CloseHandle(c->pi.hProcess);
CloseHandle(c->pi.hThread);
}
| |