Exemple #1
0
        private void button2_Click(object sender, EventArgs e)
        {
            IntPtr mainWindowHandle = IntPtr.Zero;

            foreach (Process p in Process.GetProcessesByName("steam-idle"))
            {
                ShowWindowAsync(User32API.GetWindowHandle((uint)p.Id), SW_SHOWDEFAULT);
            }
        }
Exemple #2
0
        private void HideProcessWindow(int PID)
        {
            IntPtr intptr;

            intptr = User32API.GetWindowHandle(PID);
            ShowWindow(intptr, GlobalVariable.SW_HIDE);
            if (!GlobalVariable.Hid_PID.Contains(PID))
            {
                GlobalVariable.Hid_PID.Add(PID);
            }
        }
Exemple #3
0
        private void ShowProcessWindow(int PID)
        {
            IntPtr intptr;

            intptr = User32API.GetWindowHandle(PID);
            ShowWindow(intptr, GlobalVariable.SW_SHOW);
            if (GlobalVariable.Hid_PID.Contains(PID))
            {
                GlobalVariable.Hid_PID.Remove(PID);
            }
        }
 void HideWindow_Timer_Elapsed(object sender, System.Timers.ElapsedEventArgs e)
 {
     if (!GlobalVariable.Authorized)
     {
         return;                             //授权验证
     }
     Invoke((EventHandler) delegate
     {
         Addlog("开始隐藏所有窗口……", Color.Brown, true);
     });
     for (int i = 0; i < GlobalVariable.PathAmount; i++)
     {
         if (enableData[i])
         {
             if (hideData[i])
             {
                 if (PID[i] != 0)
                 {
                     IntPtr intptr;
                     intptr = User32API.GetWindowHandle(PID[i]);
                     ShowWindow(intptr, GlobalVariable.SW_HIDE);
                     GlobalVariable.Hid_PID.Add(PID[i]);
                     Invoke((EventHandler) delegate
                     {
                         Addlog("程序[" + (i + 1) + "]隐藏完成,进程ID为:" + PID[i] + "!", Color.Green);
                     });
                 }
                 else
                 {
                     Invoke((EventHandler) delegate
                     {
                         Addlog("程序[" + (i + 1) + "]启动异常,无法隐藏!", Color.Red, true);
                     });
                 }
             }
             else
             {
                 Invoke((EventHandler) delegate
                 {
                     Addlog("程序[" + (i + 1) + "]被用户设定为不需要隐藏,跳过.", Color.YellowGreen);
                 });
             }
         }
         else
         {
             Invoke((EventHandler) delegate
             {
                 Addlog("程序[" + (i + 1) + "]被用户禁用,跳过.", Color.YellowGreen);
             });
         }
     }
     HideWindow_Timer.Enabled = false;
     if (GlobalVariable.EnableAutoExit)
     {
         GlobalVariable.ShutdownCountdown = GlobalVariable.Default_ShutdownCountdown;
         Invoke((EventHandler) delegate
         {
             UpdateCountDown();
             Addlog("全部窗口隐藏完成,将在" + GlobalVariable.Default_ShutdownCountdown + "秒后退出软件!", Color.Green, true);
         });
         Shutdown_Timer.Enabled = true;
     }
     else
     {
         Invoke((EventHandler) delegate
         {
             Addlog("全部窗口隐藏完成,无需执行其他操作!", Color.Brown, true);
             StartButton.Enabled = true;
         });
     }
 }