使用CreateProcess()创建进程

#include 
#include 
using namespace std;
 
int main(int argc, char* argv[])
{
	STARTUPINFO si = { sizeof(si) };
	PROCESS_INFORMATION pi;
 
	si.dwFlags = STARTF_USESHOWWINDOW;
	si.wShowWindow = TRUE;
	char szCommandLine[]="cmd";
	BOOL bRet = ::CreateProcess (
		NULL,
		szCommandLine,
		NULL,
		NULL,
		FALSE,
		CREATE_NEW_CONSOLE,
		NULL,
		NULL,
		&si,
		&pi);
	int nError = GetLastError();
	if(bRet)
	{
		cout<<"进程的进程ID号:"<

 

你可能感兴趣的:(Windows核心编程)