Sign in to follow this  
wease

How can I draw to the desktop with GetDesktopWindow()?

Recommended Posts

I'm also trying to draw to the desktop. I found this function GetDesktopWindow() which supposedly returns an HWND to the desktop window. However, when I use this HWND in my CreateDevice function, nothing happens. My program compiles and runs but I see no graphics. If I use a real window though in the CreateDevice function, my program works fine. Any ideas? My alternative is to draw to the desktop by using an activeX control and active desktop. I'm having some trouble getting an HWND to the activeX control though to create the devicel

Share this post


Link to post
Share on other sites
ok, well, I've been shown how to write to the activeX control so that solves my problem...but I would still rather draw directly to the desktop if there is a way and avoid using the activeX control.

Share this post


Link to post
Share on other sites
As far as I know Windows itself is the only 'application' who has the right to draw to desktop. I think that is the reason you don't see anything, although I'm not 100% sure about this.

Share this post


Link to post
Share on other sites
You can call GetDC on the desktop window, and actually draw on it (at least that worked a while back).
But really, you shouldn't. This leads to all kinds of drawing issues as you're not supposed to draw there.
Every other window update will "interfere".

Share this post


Link to post
Share on other sites
perhaps you may consider using "regions". You can create a window whatever shape you like around a bitmap if you define the windows region (rather then the default rectangle). If this special window has the always on top style set, it will always appear infront of everything and is a perfectly legal way of doing things.

Share this post


Link to post
Share on other sites
yeah, I've tried the getDC thing. It works...you can draw on the desktop with it like you said. However, instead, i've opted for the active desktop methods. They work quite well and make drawing on the desktop relatively easy.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this