using System; using System.Threading; using System.Reflection; using System.Windows.Forms; public class HelloWorldForm : Form { public HelloWorldForm() { Text = "Hello, WindowsForms!"; } }
public class ApplicationEventHandlerClass { public void OnApplicationExit(object sender, EventArgs e) { try { Console.WriteLine("The application is shutting down."); } catch(NotSupportedException) { } } }
public class MainClass { public static void Main() { HelloWorldForm FormObject = new HelloWorldForm(); ApplicationEventHandlerClass AppEvents = new ApplicationEventHandlerClass();
Application.ApplicationExit += new EventHandler(AppEvents.OnApplicationExit); Application.Run(FormObject); } }
进程是内核对象, 可以wait, 也可以从这个角度做
我的进程名字是 abc.exe请问 在abc.exe进程结束后 执行代码代码a=2,,,
public class HelloWorldForm : Form { public HelloWorldForm() { Text = "Hello, WindowsForms!"; } }
public class ApplicationEventHandlerClass { public void OnApplicationExit(object sender, EventArgs e) { try { Console.WriteLine("The application is shutting down."); } catch(NotSupportedException) { } } }
public class MainClass { public static void Main() { HelloWorldForm FormObject = new HelloWorldForm(); ApplicationEventHandlerClass AppEvents = new ApplicationEventHandlerClass();
Application.ApplicationExit += new EventHandler(AppEvents.OnApplicationExit); Application.Run(FormObject); } }
Application.ApplicationExit += (Application_ApplicationExit);void Application_ApplicationExit(object sender, EventArgs e)
{
}
using System;
using System.Threading;
using System.Reflection;
using System.Windows.Forms;
public class HelloWorldForm : Form
{
public HelloWorldForm()
{
Text = "Hello, WindowsForms!";
}
}
public class ApplicationEventHandlerClass
{
public void OnApplicationExit(object sender, EventArgs e)
{
try
{
Console.WriteLine("The application is shutting down.");
}
catch(NotSupportedException)
{
}
}
}
public class MainClass
{
public static void Main()
{
HelloWorldForm FormObject = new HelloWorldForm();
ApplicationEventHandlerClass AppEvents = new ApplicationEventHandlerClass();
Application.ApplicationExit += new EventHandler(AppEvents.OnApplicationExit);
Application.Run(FormObject);
}
}
进程是内核对象, 可以wait, 也可以从这个角度做
{
public HelloWorldForm()
{
Text = "Hello, WindowsForms!";
}
}
public class ApplicationEventHandlerClass
{
public void OnApplicationExit(object sender, EventArgs e)
{
try
{
Console.WriteLine("The application is shutting down.");
}
catch(NotSupportedException)
{
}
}
}
public class MainClass
{
public static void Main()
{
HelloWorldForm FormObject = new HelloWorldForm();
ApplicationEventHandlerClass AppEvents = new ApplicationEventHandlerClass();
Application.ApplicationExit += new EventHandler(AppEvents.OnApplicationExit);
Application.Run(FormObject);
}
}