Capture the screen before I show my window? :)

Started by
2 comments, last by RanmaruX 18 years, 1 month ago
Ok I'm using C++ with DirectX (so therefore it's a win32 app). What I'd like to do is capture the screen when the user runs my program (but before I show my window). Is this easily done and if so, can anyone suggest how? I'm just thinking of cool things to do at the start of the program :p
Advertisement
I vaguely remember (someone please correct me) that if you call GetDC() but pass 0 as the HWND parameter, you get a DC of the current desktop which you could then copy to a bitmap or whatever using the GDI.

I suppose this would work if you called it before your ShowWindow() call in WinMain.

Sorry to be so vague.
I guess you could use GetDesktopWindow and GetWindowDC... it's a bit long since last i used win32 api :P

EDIT:
After reading it again, I'm not quite sure this is what you want. What did you really mean? Are you going to capture the whole desktop, or the frame you're currently rendering? At first I thought you were going to do something like this:

http://www.vbaccelerator.com/home/VB/Code/Libraries/Graphics_and_GDI/Changing_Window_Shapes/Creating_Window_Shapes_from_Bitmaps/article.asp

[Edited by - e-u-l-o-g-y on March 17, 2006 11:25:48 AM]
my-eulogy - A blog about coding and gfxsdgi - Semi-Daily Game IdeaChunkyHacker - Viewer for Relic chunky formats (used in DOW)
Anyone ever play Terminal City on the c64? ;)

I was thinking of having it so the first screen the player sees when they run the program is an image of their desktop (or whatever was on screen when they ran the program) and then maybe having it shrink into nothing or doing some other kind of transition between that and the loading / intro screen.

I'm sure you'd notice some flicker or some obvious difference when it switches between the real desktop and the program's 'fake' desktop but it would be interesting to try it :)

This topic is closed to new replies.

Advertisement