gottygolly Posted December 4, 2014 Share Posted December 4, 2014 I've started to mess around with GDI+ stuff and I just wrote this messing around but I ran into a problem where I don't know how to move the image (screen capture). I looked for stuff and I found some things but none of them seem to work. #include<gdiplus.au3> #include <ScreenCapture.au3> #include<winapi.au3> Global Const $iW = 750,$iH = 600 $gui = GUICreate("",$iW,$iH,-1,-1) Opt("GUIOnEventMode",1) GUISetOnEvent(-3,"_Exit") $mp_x = "" $mp_y = "" GUISetState() _GDIPlus_Startup() $capture = _ScreenCapture_Capture() $tt = _GDIPlus_ImageAttributesCreate() $hwnd = _GDIPlus_GraphicsCreateFromHWND($gui) $bit = _GDIPlus_BitmapCreateFromHBITMAP($capture) $context = _GDIPlus_ImageGetGraphicsContext($bit) ;_GDIPlus_GraphicsDrawImage($context,$bit,0,0) _GDIPlus_GraphicsDrawImageRectRect($hwnd,$bit,100,100,$iW,$iH,0,0,$iW,$iH,$tt) _GDIPlus_GraphicsSetSmoothingMode($context,2) While 1 $mp = GUIGetCursorInfo($gui) If $mp[0] <> $mp_x Or $mp[1] <> $mp_y Then _GDIPlus_GraphicsClear($hwnd,0xFFFFFFFF) $gg = _GDIPlus_GraphicsDrawImageRectRect($hwnd,$bit,$mp[0],$mp[1],$iW,$iH,0,0,$iW,$iH,$tt) $mp_x = $mp[0] $mp_y = $mp[1] EndIf Sleep(10) WEnd Func _Exit() _GDIPlus_GraphicsDispose($context) _GDIPlus_GraphicsDispose($hwnd) _GDIPlus_Shutdown Exit EndFunc Thanks in advance. Link to comment Share on other sites More sharing options...
UEZ Posted December 4, 2014 Share Posted December 4, 2014 (edited) Try somethin' like that here. expandcollapse popup#include <gdiplus.au3> #include <ScreenCapture.au3> Global Const $iW = 750, $iH = 600 $gui = GUICreate("", $iW, $iH, -1, -1) Opt("GUIOnEventMode", 1) GUISetOnEvent(-3, "_Exit") $mp_x = "" $mp_y = "" GUISetState() _GDIPlus_Startup() $capture = _ScreenCapture_Capture() $hwnd = _GDIPlus_GraphicsCreateFromHWND($gui) $bit = _GDIPlus_BitmapCreateFromHBITMAP($capture) $hBitmap = _GDIPlus_BitmapCreateFromScan0($iW, $iH) $context = _GDIPlus_ImageGetGraphicsContext($hBitmap) While 1 $mp = GUIGetCursorInfo($gui) If $mp[0] <> $mp_x Or $mp[1] <> $mp_y Then _GDIPlus_GraphicsClear($context) _GDIPlus_GraphicsDrawImageRectRect($context, $bit, $mp[0], $mp[1], $iW, $iH, 0, 0, $iW, $iH) _GDIPlus_GraphicsDrawImage($hwnd, $hBitmap, 0, 0) $mp_x = $mp[0] $mp_y = $mp[1] EndIf Sleep(10) WEnd Func _Exit() _WinAPI_DeleteObject($capture) _GDIPlus_GraphicsDispose($context) _GDIPlus_GraphicsDispose($hwnd) _GDIPlus_BitmapDispose($bit) _GDIPlus_BitmapDispose($hBitmap) _GDIPlus_Shutdown Exit EndFunc ;==>_Exit Br,UEZ Edited December 4, 2014 by UEZ Please don't send me any personal message and ask for support! I will not reply! Selection of finest graphical examples at Codepen.io The own fart smells best! ✌Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ Link to comment Share on other sites More sharing options...
gottygolly Posted December 4, 2014 Author Share Posted December 4, 2014 Thank you UEZ hopefully i wont forget about this Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now