?
Solved

Capture hidden window

Posted on 2005-04-28
10
Medium Priority
?
1,126 Views
Last Modified: 2013-12-03
How to capture any hidden or partially visible window (SDI or MDI) from external process using its hWnd?
0
Comment
Question by:Bertiaux
  • 5
  • 4
10 Comments
 
LVL 55

Expert Comment

by:Jaime Olivares
ID: 13887779
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
0
 
LVL 8

Accepted Solution

by:
_corey_ earned 750 total points
ID: 13888179
Actually, you can just use the WM_PRINT message by itself.  This will work with all those versions of windows as long as the application doesn't dismiss the event.

Simply provide it a device context to draw on and you've got the image of the window.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/pantdraw_3qwk.asp ["WM_PRINT"]

corey
0
 

Author Comment

by:Bertiaux
ID: 13888332
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?
0
Nothing ever in the clear!

This technical paper will help you implement VMware’s VM encryption as well as implement Veeam encryption which together will achieve the nothing ever in the clear goal. If a bad guy steals VMs, backups or traffic they get nothing.

 
LVL 8

Expert Comment

by:_corey_
ID: 13888355
Yea, add some options to the lParam of the message.

PRF_CLIENT | PRF_NONCLIENT

Should get you the whole window.

corey
0
 

Author Comment

by:Bertiaux
ID: 13888454
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
0
 
LVL 8

Expert Comment

by:_corey_
ID: 13888486
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
0
 

Author Comment

by:Bertiaux
ID: 13888666
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.

0
 
LVL 8

Expert Comment

by:_corey_
ID: 13888717
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
0
 
LVL 8

Expert Comment

by:_corey_
ID: 13888746
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
0
 

Author Comment

by:Bertiaux
ID: 13888819
Thanks for the info,

We shall try and keep you posted.
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article describes how to add a user-defined command button to the Windows 7 Explorer toolbar.  In the previous article (http://www.experts-exchange.com/A_2172.html), we saw how to put the Delete button back there where it belongs.  "Delete" is …
What my article will show is if you ever had to do processing to a listbox without being able to just select all the items in it. My software Visual Studio 2008 crystal report v11 My issue was I wanted to add crystal report to a form and show…
This is Part 3 in a 3-part series on Experts Exchange to discuss error handling in VBA code written for Excel. Part 1 of this series discussed basic error handling code using VBA. http://www.experts-exchange.com/videos/1478/Excel-Error-Handlin…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question