Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Func _HandleCapture($Title, $SavePath = @ScriptDir&"\ImgCaptureByAutoIt.bmp")
- ;Doing the actual window capture and saving it inside $hBMP
- Local $Hwnd = WinGetHandle($Title)
- Local $hDDC = _WinAPI_GetDC($hwnd)
- Local $hCDC = _WinAPI_CreateCompatibleDC($hDDC)
- Local $Width = _WinAPI_GetWindowWidth($hwnd)
- Local $Height = _WinAPI_GetWindowHeight($hwnd)
- Local $hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, $Width, $Height)
- _WinAPI_SelectObject($hCDC, $hBMP)
- DllCall("User32.dll", "int", "PrintWindow", "hwnd", $hwnd, "hdc", $hCDC, "int", 0)
- _WinAPI_BitBlt($hCDC, 0, 0, $Width, $Height, $hDDC, 0, 0, $SRCCOPY)
- _ScreenCapture_SaveImage($SavePath, $hBMP, False) ; Debug
- ;delete resources
- _WinAPI_ReleaseDC($hwnd, $hDDC)
- _WinAPI_DeleteDC($hCDC)
- Return $hBMP
- EndFunc ;==>_HandleCapture
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement