Hi!

I am not at my dev machine now, so I can't try it
myself. Is it possible to make a screenshot of a
invisible Window? I mean a Window wich is hide
via



invoke ShowWindow, hWnd, SW_HIDE


? If I remember correct, I just get the visible part
in the area of the invisible Window... (ex: the desktop) ?!

Thanks in advance,
bAZiK
Posted on 2002-06-12 03:24:51 by bazik
Hi !

Did you try GetDCEx ???

HDC GetDCEx(
HWND hWnd, // handle to window
HRGN hrgnClip, // handle to clipping region
DWORD flags // creation options
);

with flags = DCX_WINDOW

As far as I remember it works... :rolleyes:

Hope it help !
Posted on 2002-06-12 05:08:39 by PhoBos
Hmmm... I think you got me wrong. Let me explain it in detail:

My App shells a external App. This external App does some calculations and displays the result as a Graph on the Window. I take a screenshot of the Window, resize it and save it as JPEG.
Then I terminate the App again with WM_CLOSE.

My target is, to create the screenshot WITHOUT showing the App I shell. That means, I execute it with SW_HIDE style, and do the rest as normal.

As already said, I am not at home right now... but I want this finished today, so I would appreciate any answer.

Showing the App only for the time I take the screenshot it NOT an option :(

regards,
bAZiK
Posted on 2002-06-12 06:15:51 by bazik
I don't know if if it will work but why not resize your "shell" window to a 0*0 size ?

It won't help much, if you don't want to have the program on the taskbar, though... (but I assume it can be disabled by an API... don't know which, though)
Posted on 2002-06-12 07:07:03 by JCP

I don't know if if it will work but why not resize your "shell" window to a 0*0 size ?


This would give me a 0*0 pixel screenshot.
Posted on 2002-06-12 07:10:38 by bazik
that was I was afraid of... :(
At this moment, I don't see any way of doing it...

How long takes your screen capture ?

If it is long or if we see the window for a small amount of time, you could mask it with a splashscreen saying something like : "Generating Graph"...
It is a bad way for sure, but right now, I don't have any other idea...
Posted on 2002-06-12 07:17:26 by JCP
And what about put your window outside the visible desktop area and let it visible?
with MoveWindow hWnd,2000,2000,NULL,NULL,FALSE

??? :confused: ???
Posted on 2002-06-12 07:18:02 by PhoBos
That is a better idea, it might work...

I can't test it, as I'm not on my dev machine too... ;)
Posted on 2002-06-12 07:19:57 by JCP
PhoBos,
yes, this would work, but I want a *clean* way.
Seems like I must just try what GetDC and StrechBlt give me from a Window with SW_HIDE. Perhaps I did something wrong last time...

Readiosys,
look the last sentance of my second reply:
>Showing the App only for the time I take the screenshot it NOT an option :(



:(
Posted on 2002-06-12 07:21:12 by bazik

>Showing the App only for the time I take the screenshot it NOT an option


Yes, but how long your screenshot function take or more exactly, how much time do you need the window to be displayed ?

If showing the window is not an option, you are wanting something you say as impossible because you don't want to show it...
There's a conflict in the question.

I'm not sure, but it might be a way to do it without showing the window...
Ask the GDI specialists (and I'm not one) :

news:microsoft.public.win32.programmer.gdi
Posted on 2002-06-12 07:25:51 by JCP
Bazik, did you managed to get it to work?

I'm seeking to do the same thing. I tried to move the window at -2000, -2000, but it didn't work for me.

I'm trying to fetch the rtf output and put it into a bmp for a dynamic wallpaper. I want to update it every x minutes with up to date info, but putting some window in front every count of timer isn't good...

Thanks
Posted on 2002-09-19 15:38:49 by Silas
GDI will not draw outside the area coverted by the destop window (or virtual desktop window). Thus even if you move the window outside the desktop you will not get a screenshot.

Since GDI only use 1 video page, i dont see how you could get a screenshot of the window without showing it.
Posted on 2002-09-19 15:47:33 by dxantos
I couldnt get it working and just blocked mouse and keyboard while the window showed up.
Posted on 2002-09-19 16:11:45 by bazik
Thanks, in that case, I'll have to forget about a few ideas I had.

Perhaps I could display the rich text box directly on the desktop, but I fear that either the icons will come in conflict with the display, I won't be able to create the window directly on the desktop or it will show in front of other windows when I'll update it.

Let's go back to the drawing board...
Posted on 2002-09-19 16:19:16 by Silas
bazik,
you obviously have a fair amount of control over the app you spawn, is it your app? If it is your app, why don't you modify it so you can supply a command line telling it to remain invisible, it can then draw its picture, and return a dc to the main app?
Posted on 2002-09-19 17:14:04 by sluggy
sluggy,
thanks for the input, but I already sold the app and don't care anymore about it ;)
Posted on 2002-09-20 00:43:46 by bazik