Link to home
Start Free TrialLog in
Avatar of Bertiaux
Bertiaux

asked on

Capture hidden window

How to capture any hidden or partially visible window (SDI or MDI) from external process using its hWnd?
Avatar of Jaime Olivares
Jaime Olivares
Flag of Peru image

try to use PrintWindow:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/prntspol_6qpj.asp

But won't work with win95/98/xp
ASKER CERTIFIED SOLUTION
Avatar of _corey_
_corey_

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Bertiaux
Bertiaux

ASKER

I have tested WM_PRINT message with MS Powerpoint: I do not get client area just borders and scroll bars.

Do you have any idea?
Yea, add some options to the lParam of the message.

PRF_CLIENT | PRF_NONCLIENT

Should get you the whole window.

corey
Even with these params, I just get nothing.
Is seems that some applications windows such as Powerpoint windows do not react to WM_Print.

The question seems to be the following : Is WM_Print acting on all kind of graphics or device?
Are there limitations?

Thanks
The window does need to support the WM_PRINT call in its procedure.  

PowerPoint could have limitations on when it responds to these window (visible only, or in focus, or it has to convert the display it is using to printing using a special method).

PP is probably using a form of DirectDraw or Direct3D which is not performed directly on a device context but you could try adding child and other flags to the lParam to make sure.

corey
If a form of DirectDraw or Direct3D is used, what would then be the solution?

We have tried with all the params, including the one related to child and we just get external frame.

The only way to get that image then would be to grab a copy of the front or back buffer in video memory using Direct3D.

corey
Programmatically, you would use the http://msdn.microsoft.com/library/default.asp?url=/library/en-us/directx9_c/directx/graphics/reference/d3d/interfaces/IDirect3DDevice9/GetFrontBufferData.asp ["IDirect3DDevice9::GetFrontBufferData Method"] call to get the best image.  Don't do this many times in a row as it requires a copy and can be slow.

corey
Thanks for the info,

We shall try and keep you posted.