您的位置:首页 > 编程语言 > C#

C# Winform 隐藏/显示任务栏

2014-04-17 11:40 453 查看
引用空间

using System.Runtime.InteropServices;

private const int SWP_HIDEWINDOW = 0x80;

private const int SWP_SHOWWINDOW = 0x40;

[DllImport("user32.dll")]

public static extern bool SetWindowPos(

int hWnd, // handle to window

int hWndInsertAfter, // placement-order handle

short X, // horizontal position

short Y, // vertical position

short cx, // width

short cy, // height

uint uFlags // window-positioning options

);

[DllImport("user32.dll")]

public static extern int FindWindow(

string lpClassName, // class name

string lpWindowName // window name

);

显示任务栏

int TaskBarHwnd = FindWindow("Shell_traywnd", null);

SetWindowPos(TaskBarHwnd, 0, 0, 0, 0, 0, SWP_SHOWWINDOW);

隐藏任务栏

int TaskBarHwnd = FindWindow("Shell_traywnd", null);

SetWindowPos(TaskBarHwnd, 0, 0, 0, 0, 0, SWP_HIDEWINDOW);
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: