示例#1
0
        /// <summary>
        /// 将窗口置顶
        /// </summary>
        /// <param name="windowName">窗口名称</param>
        public static void SetWindowTopMost(string windowName)
        {
            var hWnd = Win32Funcs.FindWindowWrapper(null, windowName);

            if (!hWnd.Equals(IntPtr.Zero))
            {
                SetWindowTopMost(hWnd);
            }
        }
示例#2
0
        /// <summary>
        /// 关闭窗口
        /// </summary>
        /// <param name="windowName">窗口名称</param>
        public static void CloseWindow(string windowName)
        {
            var hWnd = Win32Funcs.FindWindowWrapper(null, windowName);

            if (!hWnd.Equals(IntPtr.Zero))
            {
                Win32Funcs.SendMessageWrapper(hWnd, Win32Consts.WM_CLOSE, IntPtr.Zero, IntPtr.Zero);
            }
        }
示例#3
0
        public static void ShowTaskBar(bool show)
        {
            var cmd = show ? Win32Consts.SW_RESTORE : Win32Consts.SW_HIDE;

            //系统任务栏
            var handle = Win32Funcs.FindWindowWrapper("Shell_TrayWnd", null);

            if (!IntPtr.Zero.Equals(handle))
            {
                Win32Funcs.ShowWindowWrapper(handle, cmd);
            }

            //开始菜单栏按钮
            handle = Win32Funcs.FindWindowWrapper("Button", null);
            if (!IntPtr.Zero.Equals(handle))
            {
                Win32Funcs.ShowWindowWrapper(handle, cmd);
            }
        }
示例#4
0
        /// <summary>
        /// 将窗口置底
        /// </summary>
        /// <param name="windowName">窗口名称</param>
        public static bool SetWindowBottom(string windowName)
        {
            var hWnd = Win32Funcs.FindWindowWrapper(null, windowName);

            return(!hWnd.Equals(IntPtr.Zero) && SetWindowBottom(hWnd));
        }