1.ANSI
在ANSI版本下CreateProcess被映射为CreateProcessA,只需要少量参数就可以调用这个API,比如:
1 TCHAR szAppName[_MAX_PATH] = _T("iexplore.exe");//IE浏览器程序
2 TCHAR szCmdLine[_MAX_PATH] = _T("http://www.cppblogs.com");
3 CreateProcessA(szAppName,szCmdLine, NULL, NULL,FALSE, 0, NULL, NULL, NULL, NULL);
2.Unicode
在Unicode版本下CreateProcess被映射为CreateProcessW,最少也需要3个参数,否则就失败,比如:
1TCHAR szAppName[_MAX_PATH] = _T("iexplore.exe");//IE浏览器程序
2TCHAR szCmdLine[_MAX_PATH] = _T("http://www.cppblogs.com");
3
4 STARTUPINFO startupinfo;
5 startupinfo.cb = sizeof(STARTUPINFO);
6 ZeroMemory(&startupinfo,sizeof(startupinfo));
7
8 PROCESS_INFORMATION processinfo;
9 ZeroMemory(&processinfo,sizeof(processinfo));
10
11 CreateProcesssW(zAppName,szCmdLine,NULL,NULL,NULL, NULL,NULL,NULL,&startupinfo,&processinfo);
12
13