views:

167

answers:

2

I've seen things like this and I was wondering if this was possible, say I run my application and it will show the render on whatever is below it.

So basically, rendering on the screen without a window.

Possible or a lie?

Note: Want to do this on windows and in c++.

+2  A: 

It is possible to use your application to draw on other application's windows. Once you have found the window you want, you have it's HWND, you can then use it just like it was your own window for the purposes of drawing. But since that window doesn't know you have done this, it will probably mess up whatever you have drawn on it when it tries to redraw itself.

There are some very complicated ways of getting around this, some of them involve using windows "hooks" to intercept drawing messages to that window so you know when it has redrawn so that you can do your redrawing as well.

Another option is to use clipping regions on a window. This can allow you to give your window an unusual shape, and have everything behind it still look correct.

There are also ways to take over drawing of the desktop background window, and you can actually run an application that draws animations and stuff on the desktop background (while the desktop is still usable). At least, this was possible up through XP, not sure if it has changed in Vista/Win7.

Unfortunately, all of these options are too very complex to go in depth without more information on what you are trying to do.

SoapBox
+1  A: 

You can use GetDesktopWindow(), to get the HWND of the desktop. But as a previous answer says (SoapBox), be careful, you may mess up the desktop because the OS expects that it owns it.

gbrandt
Yes it's tricky to work with it (properly), my guess was that I could rasterize every frame and then use this as a custom shaped window the whole time but that would become rather slow.I've used GDI before to draw png's on the desktop etc but getting animations in this is a bit tricky but I'll try to do my rasterization idea with GDI, render everything to a png and use this with GDI. Thanks for the help SoapBox and gbrandt of course.
Yonathan Klijnsma