How do I check whether or not open windows completely occlude the desktop?
I'm writing a program in C# .net that changes the desktop background only when the desktop is not visible to the user, i.e. completely covered in some way by the currently open windows.
Ideally the solution would fire an event whenever it detected a change in the desktop's visibility, but right now T'm not even sure how to check visibility in the first place, other than scanning every pixel (incredibly inefficient) or periodically looping through all open windows and checking their dimensions (still inefficient and I've no idea how to implement.)
I've been fooling around with Windows.Forms.Screen and the user32.dll methods listed here, but haven't managed to figure out anyt开发者_运维技巧hing effective.
Many thanks to anyone kind enough to help!
You could just detect when another Windows application is running in full screen mode, which is simplier to detect and more likely than the desktop being covered up by a patchwork of windows.
Example code here: http://www.richard-banks.org/2007/09/how-to-detect-if-another-application-is.html
精彩评论