Friends,
I just need to print screen the full height of a window that has scroll bar.
normally getWindowRect only returns the visible portion of the window. not the hidden part. i just want to print screen the full height .
any advise :confused:
Printable View
Friends,
I just need to print screen the full height of a window that has scroll bar.
normally getWindowRect only returns the visible portion of the window. not the hidden part. i just want to print screen the full height .
any advise :confused:
Is it your window or third party?
Well, you can try doing something as simple as this:
However, you may as well want to explore some other api functions like GetWindowPlacement and SetWindowPlacement.Code:Option Explicit
Private Declare Function FindWindow Lib "User32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Const HWND_NOTOPMOST = -2
Private Const SWP_NOACTIVATE = &H10
Private Const SWP_SHOWWINDOW = &H40
Private Declare Sub SetWindowPos Lib "User32" _
(ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal X As Long, _
ByVal Y As Long, ByVal cx As Long, ByVal cy As Long, ByVal wFlags As Long)
Private Sub Command1_Click()
Dim ret As Long
Dim wnd As Long
wnd = FindWindow(vbNullString, "My Documents") '<<< I had Windows Explorer sized down
'get actual window size here using GetWindowRect
'and use values after you're done to restore it original size
SetWindowPos wnd, HWND_NOTOPMOST, 0, 0, _
Screen.Width * Screen.TwipsPerPixelX, Screen.Height * Screen.TwipsPerPixelY, _
SWP_NOACTIVATE Or SWP_SHOWWINDOW
'do whatever
'restore window to its original size here
End Sub
RhinoBulls
I am confused with your code
http://img297.imageshack.us/img297/2328/screenshotr.jpg
scren.height and screen.width i dont thik will work in most situation. coz if you take a webpage, that is heigher than the screen :(
How to get the full height of this winodw including the hidden part top and bottom?
coz i want to get a snap shot of the full list.
BTW, I think if i can get the Scroll height of the window, then also ok. how to do that?
Actually you can take a snap shot of a web page that is taller then the height of your screen using the webbrowser control..
http://www.vbforums.com/showpost.php...3&postcount=32
http://www.vbforums.com/showpost.php...4&postcount=29
Now if you can do the same with an external app that's something I'd like to see, I have no clue how you'd go about doing that.
Fazi, I doubt seriously you will be able to do what you want without manipulating the other window. Using listings for example, many list windows don't try to cache the entire "list" to a DC, because if the list had 1,000s of items in it the bitmap in that DC would be massive in size and probably errors if tried to be created. Most will simply redraw only the items that can be shown on the visible dc.
So, I think the answer would be to literally scroll the window remotely. Scroll it to the top, take snap shot, scroll it a page, take another snap shot, etc. And after you are done, it would be probably a good idea to set the window back to the original scroll position. I think you'd be able to use SendMessage and fire off some WM_VScroll/WM_HScroll messages. Or maybe use the Get/SetScrollPos APIs?
Another option, which probably wouldn't please anyone, would be to SetParent the target window (if possible) to the desktop, maximize it, then send scroll messages as mentioned above. The idea, if it works, would be far less screenshots, but obviously much larger screenshots. Of course, you'd have to put it back (SetParent) and resize it to original size once done. Just thinking off the top of my head.
Thank you
The first solution is what really in my mind. but i am not sure how decided the amount of scroll on each snap. i think for this we need the total scroll height + top & bottom arrow button height is it? if so , how to get that?
2nd solution. yah i think this is the solution rino bull also gave it seems.
first ill try this solution and see how it work :thumb: