MrChiliCheese Posted June 26, 2009 Posted June 26, 2009 (edited) Hey guys, i have written a 2x zoom tool for my 37" LCD-TV, maybe anyone of you could use it, too expandcollapse popup#include <GDIplus.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> #include <WindowsConstants.au3> Opt("GUIOnEventMode", 1) $FW = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 78) $FH = DllCall("user32.dll", "int", "GetSystemMetrics", "int", 79) $XA = @DesktopWidth $YA = @DesktopHeight $WA = $FW[0] $HA = $FH[0] $hGUI = GUICreate("MonView", 200, 200, -1, -1, BitOR($WS_POPUP, $WS_BORDER, $WS_DISABLED), BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)) GUISetOnEvent($GUI_EVENT_CLOSE, "_Exit") Dim $fR = 1, $yS, $xS, $wPosX, $wPosY, $mXo, $mYo, $fTs = 0 _GDIPlus_Startup() $timer = TimerInit() While 1 ;~ Get CursorPos $mX = MouseGetPos(0) $mY = MouseGetPos(1) ;~ X-Koordinate Switch $mX Case 0 To 252 $x = $mX + 51 $xS = True Case 253 To $WA - 254 If $xS Then $x = $mX + 51 Else $x = $mX - 252 EndIf Case $WA - 253 To $WA $x = $mX - 252 $xS = False EndSwitch ;~ Y-Koordinate Switch $mY Case 0 To 252 $y = $mY + 51 $yS = True Case 253 To $HA - 254 If $yS Then $y = $mY + 51 Else $y = $mY - 252 EndIf Case $HA - 253 To @DesktopHeight $y = $mY - 252 $yS = False Case @DesktopHeight + 1 To $HA $y = $mY - 308 $yS = False EndSwitch ;~ Move Window If $mX = $mXo And $mX = $mXo Then If $fTs = 0 Then $fT = TimerInit() $fTs = 1 EndIf If TimerDiff ($fT) > 5000 And $fTs = 1 Then Exit EndIf Else $fTs = 0 EndIf If $x <> $wPosX Or $y <> $wPosY And $fR = 0 Then WinMove($hGUI, "", $x, $y) EndIf If $fR = 0 Then _Shot($mX, $mY) EndIf If $fR = 1 Then WinMove($hGUI, "", $x, $y) GUISetState() _Shot($mX, $mY) $fR = 0 EndIf $wPos = WinGetPos($hGUI) $wPosX = $wPos[0] $wPosY = $wPos[1] $mXo = $mX $mYo = $mY If TimerDiff($timer) > 1000 Then $timer = TimerInit() WinSetOnTop ($hGui, "",1) EndIf Sleep(50) WEnd Func _Exit() _GDIPlus_Shutdown() GUIDelete() Exit EndFunc ;==>_Exit Func _Shot($mX, $mY) $sCap = _ScreenCapture_Capture("", $mX - 50, $mY - 50, $mX + 50, $mY + 50, False) $sCapBM = _GDIPlus_BitmapCreateFromHBITMAP($sCap) $sCapX = _GDIPlus_ImageGetWidth($sCapBM) $sCapY = _GDIPlus_ImageGetHeight($sCapBM) $sGraphic = _GDIPlus_GraphicsCreateFromHWND($hGUI) _GDIPlus_GraphicsDrawImageRectRect($sGraphic, $sCapBM, 0, 0, $sCapX, $sCapY, 0, 0, 200, 200) _GDIPlus_GraphicsDispose($sGraphic) _GDIPlus_ImageDispose($sCapBM) _WinAPI_DeleteObject($sCap) EndFunc ;==>_Shot have fun, yetrael Edited June 26, 2009 by yetrael
UEZ Posted June 26, 2009 Posted June 26, 2009 Nice but these includes are missing: #include <GDIplus.au3> #include <GUIConstantsEx.au3> #include <ScreenCapture.au3> #include <WindowsConstants.au3> Further, why is the mouse in the middle of the zoom screen permanently? 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!¯\_(ツ)_/¯ ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ
MrChiliCheese Posted June 26, 2009 Author Posted June 26, 2009 Thanks again UEZ, i missed the includes while copying... Now the cursor is hidden
Achilles Posted June 26, 2009 Posted June 26, 2009 Nice work! It runs smoothly and I didn't find any problems... My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list]
MrChiliCheese Posted June 26, 2009 Author Posted June 26, 2009 Thanks, happy to hear this The only "problem" i have so far, is the different vertical resolution of my PC-Monitor and my LCD... PC runs with 1024px, lcd with 1080px. When i move the coursor from lcd to pc monitor it appears a little bit under or out of the screen... Hope u understand my english
gseller Posted June 26, 2009 Posted June 26, 2009 Very nice!! It is a bit jittery on my pc with vista x64.. Still great if ya need a bit of ZOOM.. Thanks for sharing...
AlmarM Posted June 27, 2009 Posted June 27, 2009 Very nice! Minesweeper A minesweeper game created in autoit, source available. _Mouse_UDF An UDF for registering functions to mouse events, made in pure autoit. 2D Hitbox Editor A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.
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