• 隐藏/显示任务栏


      /// <summary>
            /// Retrieves a handle to the top-level window whose class name and window name match the specified strings. This function does not search child windows. This function does not perform a case-sensitive search.
            /// </summary>
            /// <param name="lpClassName">The class name or a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpClassName; the high-order word must be zero.
    ///If lpClassName points to a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, or any of the predefined control-class names.
    ///If lpClassName is NULL, it finds any window whose title matches the lpWindowName parameter.</param>
            /// <param name="lpWindowName">The window name (the window's title). If this parameter is NULL, all window names match.</param>
            /// <returns></returns>
            [DllImport("user32.dll")]
            public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
            /// <summary>
            /// Sets the specified window's show state.
            /// </summary>
            /// <param name="hwnd">A handle to the window.</param>
            /// <param name="nCmdShow">Controls how the window is to be shown. This parameter is ignored the first time an application calls ShowWindow, if the program that launched the application provides a STARTUPINFO structure. Otherwise, the first time ShowWindow is called, the value should be the value obtained by the WinMain function in its nCmdShow parameter. In subsequent calls, this parameter can be one of the following values.</param>
            /// <returns></returns>
            [DllImport("user32.dll")]
            public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
           
            private const int SW_HIDE = 0;
            private const int SW_RESTORE = 9;
            private void btnHide_Click(object sender, EventArgs e)
            {
                ShowWindow(FindWindow("Shell_TrayWnd", null), SW_HIDE); 
            }
    
            private void btnShow_Click(object sender, EventArgs e)
            {
                ShowWindow(FindWindow("Shell_TrayWnd", null), SW_RESTORE);
            }
  • 相关阅读:
    Nacos 1.3.0版本部署连接mysql 8+
    Java Certificate证书问题
    UIKit之浅析UIButton
    Xcode Coule not launch "aaa" press launch failed:timed out waiting for app launch
    Cocos2d-x 安装教程for mac(Xcode)
    关于继承UITableViewController若干问题
    Table的分割线偏移量设置 及其 UIEdgeInset详解
    retain、strong、weak、assign区别
    iOS 使用xib创建cell的两种初始化方式
    No architectures to compile for (ONLY_ACTIVE_ARCH=YES, active arch=x86_64, VALID_ARCHS=armv7 armv7s)
  • 原文地址:https://www.cnblogs.com/wjshan0808/p/4233973.html
Copyright © 2020-2023  润新知