0

I search for the function that run programm by path, and working of main programm is stopped until run second programm. Can i do that by using System.Diagnostics.Process class?

Xaver
  • 991
  • 2
  • 19
  • 37

1 Answers1

1

look at this question


Use this if you want to just use the win32 api

#include <stdio.h>
#include <Windows.h>

int main(int argc, char ** argv)
{
 STARTUPINFO SI;
 PROCESS_INFORMATION PI;
 memset(&SI,0,sizeof(SI));
 memset(&PI,0,sizeof(PI));
 SI.cb = sizeof(SI);

 //ProcessorCap
 if(!CreateProcess(NULL,"Notepad.exe ",NULL,NULL,false,0,NULL,NULL,&SI,&PI))
 {
  printf("Error %d",GetLastError());
  return 1;
 }
 DWORD ExitCode;
 do
 {
  GetExitCodeProcess(PI.hProcess,&ExitCode);
  Sleep(100);
 }while (ExitCode == STILL_ACTIVE);
 printf("Exited");
}
Community
  • 1
  • 1
rerun
  • 25,014
  • 6
  • 48
  • 78
  • i have write the example on C# what work correctly ProcessStartInfo info = new ProcessStartInfo(); info.FileName = "C:\\ACD.exe"; Process process = Process.Start(info); process.WaitForExit(); but when i write on c++ i have errors because my process have not associated process – Xaver Mar 16 '10 at 09:15