Sign in to follow this  
Followers 0
xarmandox

Capturing image of window handle (constantly)

1 post in this topic

#1 ·  Posted (edited)

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?
 

simplifying:

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 ^.^

 

Code:

#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)

GUISetState()


    $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])

    _WinAPI_DeleteObject($HBITMAP)

    ToolTip($HBITMAP)


While 1

WEnd




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)

    DllCall("User32.dll","int","PrintWindow","hwnd",$hWnd,"hwnd",$hCDC,"int",0)

    _WinAPI_ReleaseDC($hWnd, $hDDC)
    _WinAPI_DeleteDC($hCDC)

    Return $hBMP

EndFunc
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  
Followers 0