tags:

views:

42

answers:

1

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?

A: 

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");
}
rerun
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