예제 #1
0
 /// <summary>
 /// Generate a console control event.
 /// </summary>
 /// <param name="eventId">The event to generate.  This must be CtrlC or CtrlBreak.</param>
 /// <param name="processGroupId">In most cases, set to 0 to send the event to
 /// all attached processes.</param>
 public static void GenerateCtrlEvent(ConsoleControlEventType eventId, int processGroupId)
 {
     if (!WinCon.GenerateConsoleCtrlEvent((int)eventId, processGroupId))
     {
         throw new IOException("Error generating event.", Marshal.GetLastWin32Error());
     }
 }