简体   繁体   English

如何在C#中隐藏Windows桌面并更改桌面背景颜色?

[英]How to hide Windows Desktop and change desktop background color in c#?

I need to know how to hide Windows Desktop and change desktop background color in c# and restore the previous configuration. 我需要知道如何隐藏Windows桌面并在c#中更改桌面背景色并恢复以前的配置。

Any idea? 任何想法?

BR BR

Enumerate all desktop window with EnumWindows . 使用EnumWindows枚举所有桌面窗口。 Collect every visible window handle. 收集每个可见的窗口句柄。

Call ShowWindow with appropriate arguments to make the collected windows to be visible/invisible. 使用适当的参数调用ShowWindow ,以使收集的窗口可见/不可见。

Take note that all created windows after this operation will be visible. 请注意,此操作后所有创建的窗口将可见。 To hide desktop icons you shall spy the window structure (with a tool like Spy++), get specific window handle by its class name and then call ShowWindow on the obtained widnow handle. 要隐藏桌面图标,您应该监视窗口结构(使用Spy ++之类的工具),通过其类名获取特定的窗口句柄,然后在获取的Widnow句柄上调用ShowWindow。

Of course, EnumWindows and ShowWindow must be P/Invoked. 当然,必须是P / Invoked的EnumWindows和ShowWindow。 See www.pinvoke.net for getting the correct declaration. 有关正确的声明,请参见www.pinvoke.net。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM