示例#1
0
        static void Main()
        {
            var pcsttoolProcess = Process.GetProcessesByName("pcsttoolform");

            if (pcsttoolProcess.Length > 1)
            {
                var bProcess  = pcsttoolProcess.OrderBy(o => o.StartTime).FirstOrDefault();
                var placement = new Windowplacement();
                GetWindowPlacement(bProcess.MainWindowHandle, ref placement);
                if (placement.showCmd == 2)
                {
                    ShowWindow(bProcess.MainWindowHandle, ShowWindowEnum.Restore);
                }
                SetForegroundWindow(bProcess.MainWindowHandle);
                return;
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new FrmMain());
        }
示例#2
0
 static extern bool GetWindowPlacement(IntPtr hWnd, ref Windowplacement lpwndpl);