Jump to content
Sign in to follow this  

Capturing image of window handle (constantly)

Recommended Posts

I found this article in the forum autoit
it captures only time and stop
If you use '_ScreenCapture_Capture' is very easy to get to a constant image snapshot.. in real time (maybe example team viewer remote desktop but only one window by handle, because i cant see if have notepad.exe front  on my handle window)
and I was wondering ...
how can I do this using func
i cant understand all this code, but i'm trying
not all of us know all the parameters of autoit
someone could give me a little help?


I plan to capture the imagem of window even if it is not maximized on front of all
say, even if you have notepad.exe front on it.


If you have time and a good mood
even if not know help me with this update
If you think you can tell me a little about this code with a few lines of comments, I am very grateful


I want to thanks you to all who post on this topic, it will be very useful

If you ever need a new kidney, I'll be here to help you lol ^.^



#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#Include <WinAPI.au3>
#include <Constants.au3>
#Include <GDIPlus.au3>
#include <SendMessage.au3>
#include <StaticConstants.au3>

_GDIPlus_Startup ()

Global Const $STM_SETIMAGE = 0x0172
$Gui = GUICreate("idk", 700,500)


    $hImage = _WinApi_CreateWindowEx(0, "Static", "", $WS_VISIBLE+$WS_CHILD+$SS_NOTIFY+0xE, 0, 0, 700, 500, $Gui); 0xE = $SS_BITMAP

    $hWindow = WinGetHandle("Autoit Help")

    $HBITMAP = _WinCapture($hWindow)

    $hOldBitmap = DllCall("user32.dll", "hwnd", "SendMessage", "hwnd", $hImage, "int", $STM_SETIMAGE, "int", $IMAGE_BITMAP, "int", $hBitmap)

    If $hOldBitmap[0] <> 0 Then _WinAPI_DeleteObject($hOldBitmap[0])



While 1


Func _WinCapture($hWnd, $iWidth=-1, $iHeight=-1)

    Local $iH, $iW, $hDDC, $hCDC, $hBMP

    if $iWidth = -1 Then $iWidth = _WinAPI_GetWindowWidth($hWnd)
    if $iHeight = -1 Then $iHeight = _WinAPI_GetWindowHeight($hWnd)

    $hDDC = _WinAPI_GetDC($hWnd)
    $hCDC = _WinAPI_CreateCompatibleDC($hDDC)
    $hBMP = _WinAPI_CreateCompatibleBitmap($hDDC, $iWidth, $iHeight)
    _WinAPI_SelectObject($hCDC, $hBMP)


    _WinAPI_ReleaseDC($hWnd, $hDDC)

    Return $hBMP

Edited by xarmandox

Share this post

Link to post
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
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...