예제 #1
0
 /// <summary>
 /// 禁止在处理时关闭
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void MainWindow_FormClosing(object sender, FormClosingEventArgs e)
 {
     foreach (var title in this.dialogBoxTitles)
     {
         IntPtr handle = GetWindowHandle.GetDialogBoxHandle(title);
         if (handle != IntPtr.Zero)                                      // 找到
         {
             if (MyWindowState.Visible.IsWindowVisible(handle) == false) // 存在处理中
             {
                 e.Cancel = true;                                        // 取消退出
                 return;
             }
         }
     }
     notifyIcon.Visible = false;
 }
예제 #2
0
 private void timer_Tick(object sender, EventArgs e)
 {
     foreach (var title in this.dialogBoxTitles)
     {
         IntPtr handle = GetWindowHandle.GetDialogBoxHandle(title);
         if (handle != IntPtr.Zero)                                     // 找到
         {
             if (MyWindowState.Visible.IsWindowVisible(handle) == true) // 非处理中
             {
                 EditDialogBox edb = new EditDialogBox(handle);
                 edb.Show();
                 break;
             }
         }
     }
 }