今天,有网友询问,如何显示和隐藏任务栏?
我这里,发布一下使用Windows API 显示和隐藏 Windows 的任务栏的方法,windows 的任务栏,其实是一个窗口(window),只要找到这个窗口的句柄,显示和隐藏就轻而易举了,任务栏是个没有标题的窗口,但它的类名是 Shell_TrayWnd,所以,可以用FindWindow 或 FindWindowEx 去查找它的句柄,而显示和隐藏窗口,使用的是 ShowWindow:
[DllImport("user32.dll", EntryPoint = "FindWindowEx", SetLastError = true)]
static extern IntPtr FindWindowEx(IntPtr hwndParent, IntPtr hwndChildAfter, string lpszClass, string lpszWindow);
[DllImport("user32.dll", EntryPoint = "ShowWindow", SetLastError = true)]
static extern bool ShowWindow(IntPtr hWnd, uint nCmdShow);
<script type="text/javascript"><!--
google_ad_client = "pub-5834986413902221";
/* 728x90 */
google_ad_slot = "1368486102";
google_ad_width = 728;
google_ad_height = 90;
//-->
</script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script>
IntPtr trayHwnd = FindWindowEx(IntPtr.Zero, IntPtr.Zero, "Shell_TrayWnd", null);
if (trayHwnd != IntPtr.Zero)
{
ShowWindow(trayHwnd, 0);
}
上面的代码中, ShowWindow 的第二参数, 1 表示显示, 0 表示隐藏
分享到:
相关推荐
易语言隐藏任务栏或托盘图标模块源码,隐藏任务栏或托盘图标模块,隐藏任务栏图标,隐藏托盘图标,取句柄,GetButtonInfo,FindWindow,FindWindowEx,SendMessage,GetWindowThreadProcessId,OpenProcess,DuplicateHandle,...
易语言隐藏外部程序任务栏图标和系统托盘图标模块和源码,FindWindow,FindWindowEx,SendMessage,GetWindowThreadProcessId,OpenProcess,DuplicateHandle,GetCurrentProcess,CloseHandle,VirtualAllocEx,...
易语言隐藏任务栏程序源码,隐藏任务栏程序,取当前窗口图标,程序_取窗口标题,句柄取进程文件名,FindWindow,GetForegroundWindow,FindWindowEx,ShowWindow,IsWindow,IsWindowVisible,GetWindowText,IsWindowVisible1,...
隐藏win7任务栏源码 [DllImport("user32.dll", EntryPoint = "FindWindowEx", SetLastError = true)]
易语言隐藏显示桌面图标源码,隐藏显示桌面图标,FindWindowEx,ShowWindow
Delphi7.0 隐藏状态栏中的时间源代码,常规情况下,windows 的右下角都会显示时间日期,本功能是把状态栏中的时间和日期隐藏掉,隐藏后变成了如测试图所示的效果,看上去怪怪的,嘿嘿,当然本程序也可重新显示时间,...
WPF界面最大化不覆盖任务栏 ,通过计算任务栏尺寸 IntPtr taskBarWnd = FindWindow("Shell_TrayWnd", null); IntPtr tray = FindWindowEx(taskBarWnd, IntPtr.Zero, "TrayNotifyWnd", null); IntPtr trayclock...
在“新建项目”对话框的项目类型窗口中选中“Visual C#”作为项目开发语言,在模板窗口中选中“Windows 应用程序”作为项目开发模板,在“名称”、“位置”编辑框中输入自己设定的项目名字和项目存储位置,本讲义...
隐藏、显示开始按钮程序"FindWindowA","FindWindowExA"的应用(VB6.0源代码编写) 隐藏、显示开始按钮。 "FindWindowA" (ByVal lpClassName As String, _ ByVal lpWindowName As String) As Long Private Declare ...
Delphi refreshtray移除无效的Windows系统托盘图标,非鼠标移动模拟方法,相关的代码: begin hStatus := FindWindow('Shell_TrayWnd',nil); //得到任务栏句柄 if not iswindow(hStatus) then exit; ...
VC 隐藏和显示开始菜单按钮,这个似乎以前发过的,也比较简单,程序功能:隐藏开始菜单的按钮、显示开始菜单的按钮,主要是想让大家了解VC 与Windows相关的编程技巧。有兴趣的参考下面的代码: void ...
C#关于外挂汉化的一些思考(API函数FindWindow,FindWindowEx,SendMessage)
迅雷看看“本片即将结束,你可能也喜欢以下内容”提示的去除工具。 详见http://blog.csdn.net/wwwwws/article/details/9433817
例如,导入“User32.dll”中的FindWindow、FindWindowEx函数查找窗口,并获取窗口句柄,也可直接利用C#中的Process类来启动程序,并获取这个进程的主窗口的句柄。 以上只是简单的介绍了利用C#的Process类和Win32 API...
Option ExplicitPrivate Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As ...
IntPtr hwndButton = NativeMethods.FindWindowEx(hWnd, IntPtr.Zero, "Button", "发送(S)"); if (IntPtr.Zero != hwndButton) { ////找到窗体顺序上的第一个RichEdit20A控件,其实就是消息显示框 IntPtr ...
添加单张图片或整个图片文件夹,可以进行缩放,旋转
Windows NT5.0 and later:如果hwndParent是HWND_MESSAGE,函数仅查找所有消息窗口。 (2)hwndChildAfter :子窗口句柄。查找从在Z序中的下一个子窗口开始。子窗口必须为hwndParent窗口的直接子窗口而非后代窗口。...