المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : Show Windows Desktop, nothing else...



C# Programming
10-27-2009, 07:01 AM
C# newbie here.

I am using the wonderful John’s Background Switcher (http://www.johnsadventures.com/software/backgroundswitcher/)[^ (http://www.johnsadventures.com/software/backgroundswitcher/)] to keep my wallpaper fresh and interesting, and I realized I'd like to make use of it for my screen saver, too.

Since he does not have an option for that, I thought I'd try learning how to make a little C# screensaver form that just showed the wallpaper as is.

That was about a week ago.

In my experiments, I decided there are two general ways of solving this problem:
1) create a blank desktop and display it with no apps running (or my own app, which wouldn't do anything but listen for a keypress)

2) hide everything on the existing desktop, leaving only the wallpaper visible

I have found code samples for creating desktops, but nothing that I can figure out how to make work with my tiny brain. So I concentrated on option 2.

This requires 3 steps:
a) hide all shortcut icons
b) hide all running taskbar icons [& the taskbar]
c) make wallpaper visible through my app's form

C seemed pretty easy from my Java perspective: just throw up a glasspane and be done. C# begs to differ with me.

I did finally find a way to keep my app transparent enough without allowing click-thru (mouse clicks activating the visible icons behind my transparent form), or so I think. Regardless, it won't matter if I hide everything that shouldn't be shown.

I have just now figured out how to reliably hide shortcut icons and redisplay them at will. This problem was a lot harder than it should have been because everybody seems to say "icons" when they mean the stuff on the taskbar (naturally, I assumed they'd use the term tasks or some such - silly me). But now it's good.

So now I am stuck on step B - hide everything else. I did find a PInvoke for toggling the desktop, but it has some nasty drawbacks:
- it requires including a DLL with the screen saver executable
- it does not let me know if things are visible or not
- the restore does not put things back the way they should be


I really think the first option is best (create an empty desktop), but I don't know how to make that work. If anyone has the right solution...

Barring that, does anyone know how to "properly" hide all desktop icons, and then how to restore them as they were?

No code shown because my stuff is a horrible mess and would only make this post even more confusing. But I'll post whatever bits are requested, and of course when I get it working I'll share the whole finished steaming pile of code.

????????????

Narf.