protected override void OnClosing(CancelEventArgs e)
 {
     NativeWrapper.WTSUnRegisterSessionNotification(this);
     base.OnClosing(e);
 }
 public Form1()
 {
     InitializeComponent();
     NativeWrapper.WTSRegisterSessionNotification(this, SessionNotificationType.NOTIFY_FOR_ALL_SESSIONS);
 }