天天看點

隐藏顯示工作列

實作效果:

  

隐藏顯示工作列
知識運用:

private const int SW_HIDE = 0;
        private const int SW_RESTORE = 9;
        [DllImport("user32.dll")]           //尋找視窗清單中第一個符合指定條件的頂級視窗
        public static extern int FindWindow(string IpClassName,string IpWindowName);
        [DllImport("user32.dll")]           //控制視窗的可見性
        public static extern int ShowWindow(int hwnd,int nCmdShow);
        private void button1_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked)
                ShowWindow(FindWindow("Shell_TrayWnd", null), SW_HIDE); //隐藏工作列
            else
                ShowWindow(FindWindow("Shell_TrayWnd",null),SW_RESTORE);//顯示工作列
        }