Jump to content

Is _ScreenCapture_CaptureWnd() supposed to get only client area? Because...


 Share

Recommended Posts

i keep getting everything else(borders, titlebar...)

Still, i tried to use coords to only grab client area...

#include <ScreenCapture.au3>

$hGUI = WinGetHandle("Window Title", "")
$pos = wingetpos($hGUI)
$posclient = WinGetClientSize($hGUI)

$bordersize = $pos[2] - $posclient[0]
$titlesize  = $pos[3] - $posclient[1]

WinActivate($hGUI)
; Capture window
_ScreenCapture_CaptureWnd(@MyDocumentsDir & "\GDIPlus_Image.jpg", $hGUI,
$bordersize,$titlesize,$bordersize,$bordersize)

But i am getting blank thing...

Link to comment
Share on other sites

Ok, after few more tries i think i v figured this out, if anyone is looking for solution here it is...

#include <ScreenCapture.au3>
$hGUI = WinGetHandle("Title Of Window", "")
$tRect = _WinAPI_GetClientRect($hGUI)

Local $ltpoint = DllStructCreate("int Left;int Top")
DllStructSetData($ltpoint, "Left", 0)
DllStructSetData($ltpoint, "Top", 0)
_WinAPI_ClientToScreen($hGUI, $ltpoint)
Local $rbpoint = DllStructCreate("int Right;int Bottom")
DllStructSetData($rbpoint, "Right", DllStructGetData($tRect, "Right"))
DllStructSetData($rbpoint, "Bottom", DllStructGetData($tRect, "Bottom"))
_WinAPI_ClientToScreen($hGUI, $rbpoint)

WinActivate($hGUI)
; Capture window
_ScreenCapture_Capture(@ScriptDir&"image1.jpg", DllStructGetData($ltpoint, "Left"), DllStructGetData($ltpoint, "Top"), DllStructGetData($rbpoint, "Right"), DllStructGetData($rbpoint, "Bottom"), False)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...