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);
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);
相关文章推荐
- C# CreateDataTable
- 转: 编写高质量代码改善C#程序的157个建议
- C# 图片的转换,一个简单的实例,没有特别的修饰,涉及线程
- C# zip/unzip with DotNet framework 4.5
- C# zip/unzip with ICSharpCode.SharpZipLib
- 【C#】int.parse和convert.toint32的区别
- C#文件及文件夹复制,移动,删除
- C# 中的关键字 out ref
- C#设计模式(23种设计模式)
- 在C#中使用属性控制 XML 序列化来解析XML
- PDF File Writer C# Class Library (Version 1.4)
- C#图像处理:Stream 与 byte[] 相互转换,byte[]与string,Stream 与 File 相互转换等
- c# 实现datagridview 用回车向右移动,到头换行,支持编辑模式
- C#循环语句(while语句和for语句)
- C# filter
- C#使用Zebra 斑马打印标签--使用winspool.Drv方式
- C# 操作FTP
- C# 导出导入TXT文件
- C#获取IP和主机名
- C#中的数据类型装换