进程创建

DWORD WINAPI CEXE1Dlg::StartMeeting(LPVOID param)
{
 CEXE1Dlg* pDlg = (CEXE1Dlg*)(param);
 pDlg->m_bStop = false;
 while(1)
 {
  if(!pDlg->m_bStop)
  {
   STARTUPINFO   si;  
   PROCESS_INFORMATION   pi;  

   ZeroMemory(&si, sizeof(si));  
   si.cb = sizeof(si);  
   si.wShowWindow = SW_HIDE;  
   si.dwFlags = STARTF_USESHOWWINDOW;
   ZeroMemory(&pi, sizeof(pi));  
   if(::CreateProcess(_T("C://EXE2.exe") , _T("kkkk"),  NULL,
    NULL, false, CREATE_DEFAULT_ERROR_MODE, NULL, NULL,
    &si,&pi))
   {
    ::WaitForSingleObject(pi.hProcess, INFINITE);         // 等待进程结束
    CloseHandle(pi.hProcess);    
   }
  }
  else
  {
   break;
  }
 }
 return 0;
}

你可能感兴趣的:(c,null,winapi)