zoukankan      html  css  js  c++  java
  • C#隐藏与显示系统任务栏和开始菜单栏按钮

    隐藏与显示系统任务栏和开始菜单栏按钮:
    直接上代码:
           private const int SW_HIDE = 0;  //隐藏
           private const int SW_RESTORE= 5;  //显示
     
           [DllImportAttribute("user32.dll")]  
           private static extern int FindWindow(string ClassName,string WindowName);
           [DllImport("user32.dll")]  
           private static extern int ShowWindow(int handle,int cmdShow);


          //隐藏
            private void button3_Click(object sender, EventArgs e)  
            {  
                ShowWindow(FindWindow("Shell_TrayWnd", null), SW_HIDE);//隐藏系统任务栏
                ShowWindow(FindWindow("Button", null), SW_HIDE);//隐藏系统开始菜单栏按钮
            }  
         //显示
            private void button2_Click(object sender, EventArgs e)  
            {  
                ShowWindow(FindWindow("Shell_TrayWnd", null), SW_RESTORE);//显示系统任务栏
                ShowWindow(FindWindow("Button", null), SW_RESTORE);//显示系统开始菜单栏按钮
            }


    说明:
    (1)引用了系统API函数,需要引用命名空间
             using System.Runtime.InteropServices;
    (2)ShowWindow()参数类型是一些int类型,可以查看MDNS
    也可以写成  
             ShowWindow(FindWindow("Shell_TrayWnd", null), 0); 

  • 相关阅读:
    CAP分布式
    专职DBA-MySQL数据库开篇
    os.sep
    DocStrings
    Python如何获取脚本的参数
    LVM基础命令
    VoAndEntityTrans
    短信倒计时
    springboot在eclipse上搭建项目一(无页面)
    springboot问题
  • 原文地址:https://www.cnblogs.com/qiantao/p/9405141.html
Copyright © 2011-2022 走看看