C#使用系统的“显示桌面”功能(Shell.Application)
2013-06-02 17:22
411 查看
在 Windows 系统的 任务栏 上的 快速启动栏 里,通常有一个图标
,点击这个图标,就会切换到桌面。这个图标实际是一个 “Windows Explorer Command” ,用记事本打开这个文件,我们看到如下的内容:
这个文件的格式,实际是一个 ini 文件的形式,其中,我们要关注的是 Command=ToggleDesktop 这句,这句是explorer要执行的命令;通过 MSDN 我们可以看到关于 ToggleDesktop 的说明:
This method has the same effect as the Show Desktop button in the Quick Launch area of the Taskbar.
It either hides all open windows and shows the desktop, or it hides the desktop and shows all open windows.
The ToggleDesktop method does not display any user interface, it just invokes the toggle action.
在C#中,使用 显示桌面 的功能,实际就是使用 Shell.Application 去执行 ToggleDesktop 这个功能,代码如下:
http://www.cnblogs.com/conkis/
,点击这个图标,就会切换到桌面。这个图标实际是一个 “Windows Explorer Command” ,用记事本打开这个文件,我们看到如下的内容:
[Shell] Command=2 IconFile=explorer.exe,3 [Taskbar] Command=ToggleDesktop
这个文件的格式,实际是一个 ini 文件的形式,其中,我们要关注的是 Command=ToggleDesktop 这句,这句是explorer要执行的命令;通过 MSDN 我们可以看到关于 ToggleDesktop 的说明:
This method has the same effect as the Show Desktop button in the Quick Launch area of the Taskbar.
It either hides all open windows and shows the desktop, or it hides the desktop and shows all open windows.
The ToggleDesktop method does not display any user interface, it just invokes the toggle action.
在C#中,使用 显示桌面 的功能,实际就是使用 Shell.Application 去执行 ToggleDesktop 这个功能,代码如下:
Type shellType = Type.GetTypeFromProgID("Shell.Application"); object shellObject = System.Activator.CreateInstance(shellType); shellType.InvokeMember("ToggleDesktop", System.Reflection.BindingFlags.InvokeMethod, null, shellObject, null);
http://www.cnblogs.com/conkis/
相关文章推荐
- C#使用系统的“显示桌面”功能(Shell.Application)
- C#使用系统的“显示桌面”功能(Shell.Application)
- Delphi&C#代码模拟“显示桌面”的功能(使用CreateOleObject('Shell.Application'))
- Delphi&C#代码模拟“显示桌面”的功能
- (1)Raspberry Pi的首次使用——远程桌面显示树莓派系统
- (1)Raspberry Pi的首次使用——远程桌面显示树莓派系统
- C#之使用NotifyIcon实现任务栏托盘菜单,图标闪烁效果及气泡提示 很多程序是只需要后台运行的,甚至不需要自己的应用界面。NotifyIcon提供了程序在任务栏的显示功能 程序下载链接如下
- Delphi&C#代码模拟“显示桌面”的功能
- 使用线程 在shell上同步动态显示当前系统时间
- 使用js实现显示系统当前时间并实现倒计时功能并触发模态框(遮罩)功能
- 自己做了一个C#桌面应用程序消费管理系统,功能感觉有点简陋,求点意见
- 将一串数字转化为中文字符串,使用 C# 将数字转换成大写人民币 (例如:用户输入2300,系统就会显示两千三百元 )
- 使用shell和python分别实现简单菜单功能--打印当前系统状态信息
- 使用远程桌面功能登录系统,常常遇到类似“由于帐户限制,你无法登录”的提示的解决办法
- 自己做了一个C#桌面应用程序消费管理系统,功能感觉有点简陋,求点意见
- WinXP系统控制面板中的显示功能如何禁止使用
- 使用readdir系统调用模拟shell ls功能
- Linux系统Shell命令常用功能使用详解
- 使用shell和python分别实现简单菜单功能--打印当前系统状态信息
- 使用tinymini210开发远程的温度监控系统,实现C#和安卓客户端显示数据和控制