I want to copy the contents of Windows window. I get the DC and copy it. But I want the contents only with icons and backgroundimage, but without any other tool window. Is it possible?

Posted on 2005-08-18 14:15:41 by Nordwind64
Isn't it possible?

Posted on 2005-08-19 12:14:37 by Nordwind64
I trie again.

I need a snapshot of the desktop, but without any other window in it...
Hope, you can help now. Sorry for my bad english...

Greetings, Nordwind
Posted on 2005-08-19 15:53:00 by Nordwind64
just tell us what you want to do exactly and why you need that?
Posted on 2005-08-19 16:25:00 by soorena

I need it for a little tool I want to write in future. Effects on desktop.
I don't want to work with regions.

Posted on 2005-08-19 17:22:07 by Nordwind64

is there any solution?

Posted on 2005-08-22 10:40:17 by Nordwind64
Hi Nordwind,

Yes, it is possible but I am not sure how easy it would be. When Windows draws a window on the desktop the area underneath it is saved as a bitmap. How to get the handle is beyond me, never looked at the problem before. But it is possible to grab the visible area of the desktop and paste the obscured portions into the DC. Though any program that did this would probably be very specific to a single OS version and need different versions for each one.

Another possibility is just to minimize all the open windows and grab the DC of the desktop. you might even be able make the taskbar disappear if you want to using the ITaskBar interface, though I'm not sure about this.

Yet another way to do it is to get the wallpaper from the registry (HKEY_CURRENT_USER\Control Panel\Desktop\Wallpaper), enumerate the desktop and draw the icons onto the bitmap, it will essentially be a copy of the desktop. For an example of enumerating the desktop icons see my LVDesktop9xNT example on my website...

Posted on 2005-08-22 17:47:02 by donkey
Hi donkey!

Thanks for replying.
I tested your code. Is it right, that it shows only the same one icon in all listview lines? And all have position 0/0? I tested twice, and now it worked right. I tested again and again. But most time, it showed only the one-icon-listview.

Ok, getting the background image is easy: invoke PaintDesktop,hdc

In my opinion the API GetDCEx with Flag DCX_CLIPSIBLINGS | DCX_CLIPCHILDREN should make what I won't. But it don't work...

Best regards,
Posted on 2005-08-24 14:09:13 by Nordwind64