-
I need to capture the client area of a window that is not the active window. The window I would like to capture is a program written in C(I dont know if that matters or not). I have tried several different methods of doing this and would like to know what anyone else thinks or has ideas about. Please email me ASAP with any ideas you have or if you know a surefire way to code this dilemma. Thank you kindly.
Brent Keller
-
You could find the window using the FindWindow Api, then Bring it to top, make the screenshot, restore the old position and voila.
That's the way how to do it. I could figure some code for ya
-
Try this:
Code:
Private Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan As Byte, _
ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
'Get active Window
Call keybd_event(vbKeySnapshot, 0, 0, 0)
'Get whole Screen
Call keybd_event(vbKeySnapshot, 1, 0, 0)
If you want to get a region, I suggest you use a program like HyperSnap.
-
I have written code to bring that window to the top and capture the screen. The only thing is, that I never want to see that window at all. I need to be able to capture its viewable area, preferrably by calling its window handle, then display the image in a picturebox, all while the program is running in the background and cannot be seen. Please let me know if this is impossible so that I am not wasting my time here.
Brent
-
The user won't notice it popping on and off when first making it INVISIBLE with ShowWindow Api, then brining it up, then down, then making it visible
-
jop that sounds like it would work. Can you point me towards an example of the ShowWindow API? This should work for now, I would like to know if it is possible to straight capture the area of a form by calling its handle, if anyone can let me know this I would be GREATLY appreciative.
Brent
-
Sure!
Code:
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
'First you'll have to get the window - handle, then hide it by using this:
ShowWindow Myhwnd, 0
'To make it visible again do:
ShowWindow Myhwnd, 5
i saw you allready had the code to pop-it-up and get the handle so this will work I think, goodluck, I'm going to bed