zoukankan      html  css  js  c++  java
  • win下隐藏任务栏

    C# 隐藏任务栏开始按钮 关闭shell

    分类: .NET C# 789人阅读 评论(1) 收藏 举报

     一、隐藏任务栏 开始按钮

             using System.Runtime.InteropServices;

            [DllImport("user32.dll")]
            public static extern int ShowWindow(IntPtr hwnd, int nCmdShow);
            [DllImport("user32.dll")]
            public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
            [DllImport("user32.dll")]
            public static extern IntPtr FindWindowEx(IntPtr hWnd1, IntPtr hWnd2, string lpsz1, string lpsz2);

         

           IntPtr trayHwnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", null);
                IntPtr hStar = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Button", null);
                if (trayHwnd != IntPtr.Zero && hStar != IntPtr.Zero)
                {
                    //ShowWindow(FindWindow("progman", null), 0);
                    //ShowWindow(trayHwnd, SW_HIDE);
                    //ShowWindow(hStar, SW_HIDE);

                    ShowWindow(trayHwnd, 0);
                    ShowWindow(hStar, 0);
                }

           显示反之:SW_SHOW即可。

    二、关闭shell

                    Process ps;
                    ps = new Process();
                    ps.StartInfo.FileName = "CloseExplorer.bat";
                    ps.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
                    ps.Start();  

                    CloseExplorer.bat文件内容:taskkill /f /im explorer.exe
                    exit     即可

  • 相关阅读:
    变量的作用域
    内联函数inline
    数组、函数和指针
    关于android:configChanges的属性的简介
    Android 更新UI的两种方法
    android开发两种退出程序方式
    google内购In-App Billing
    谷歌登陆sdk对接
    openssl测试版本小工具
    关于facebook登陆不安装openssl的情况下怎么获得Facebook Key Hash的简单方法
  • 原文地址:https://www.cnblogs.com/weiryang/p/3366161.html
Copyright © 2011-2022 走看看