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

Started by
4 comments, last by wease 18 years, 10 months ago
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
Advertisement
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.
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.
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".

Fruny: Ftagn! Ia! Ia! std::time_put_byname! Mglui naflftagn std::codecvt eY'ha-nthlei!,char,mbstate_t>

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.
Anything posted is personal opinion which does not in anyway reflect or represent my employer. Any code and opinion is expressed “as is” and used at your own risk – it does not constitute a legal relationship of any kind.
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.

This topic is closed to new replies.

Advertisement