示例#1
0
文件: FormMain.cs 项目: imatary/work
        /// <summary>
        /// Active Windows Title
        /// </summary>
        /// <param name="title"></param>
        private void ActiveProcess(string title)
        {
            Process[] processes    = Process.GetProcesses();
            int       windowHandle = 0;

            foreach (Process p in processes)
            {
                if (p.MainWindowTitle.Contains(title))
                {
                    windowHandle = (int)p.MainWindowHandle;
                    break;
                }
            }
            NativeWin32.SetForegroundWindow(windowHandle);
        }
示例#2
0
文件: FormMain.cs 项目: imatary/work
        private void ActiveWindows(string title)
        {
            int windowHandle = NativeWin32.FindWindow(null, title);

            NativeWin32.SetForegroundWindow(windowHandle);
        }