ARozanski Posted November 20, 2008 Share Posted November 20, 2008 Hi. I have built a program that does all sorts of random things...but one thing i would like it to do is take a certain area around the mouse pointer and either project it elsewhere on the screen magnified but unmagnified would be ok too. Just like the magnifying tool windows has. Is this possible?? I know how to get every pixel around the mouse and save it in an array. But how would i project it elsewhere on the screen Link to comment Share on other sites More sharing options...
oMBRa Posted November 20, 2008 Share Posted November 20, 2008 (edited) short example: (press alt + q ) #include <ScreenCapture.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> HotKeySet('!q', 'Magnify') Global $GUI = GUICreate('Magnify', 400, 400, 100, 100, $WS_POPUPWINDOW) While 1 Sleep(10) WEnd Func Magnify() GUISetState(@SW_HIDE) $Pos = MouseGetPos() $HBITMAP = _ScreenCapture_Capture('', $Pos[0] - 100, $Pos[1] - 100, $Pos[0] + 100, $Pos[1] + 100, False) _GDIPlus_Startup() $oBITMAP = _GDIPlus_BitmapCreateFromHBITMAP($HBITMAP) $oGRAPHIC = _GDIPlus_GraphicsCreateFromHWND($GUI) GUISetState() _GDIPlus_GraphicsDrawImageRectRect($oGRAPHIC, $oBITMAP, 0, 0, 200, 200, 0, 0, 400, 400); Draw 2x zoomed image _WinAPI_DeleteObject($HBITMAP) _GDIPlus_GraphicsDispose($oGRAPHIC) _WinAPI_DeleteObject($oBITMAP) _GDIPlus_Shutdown() EndFunc;==>Magnify Edited November 20, 2008 by oMBra Link to comment Share on other sites More sharing options...
ARozanski Posted November 20, 2008 Author Share Posted November 20, 2008 (edited) Man - that is just amazing! Thank you very much - i am seriously impressed!...but unfortunately if i try to make it a constant thing by taking out the function part and just leaving while 1...everything goes haywire :-/ ... thanks anyways Edited November 20, 2008 by ARozanski Link to comment Share on other sites More sharing options...
martin Posted November 20, 2008 Share Posted November 20, 2008 Man - that is just amazing! Thank you very much - i am seriously impressed!...but unfortunately if i try to make it a constant thing by taking out the function part and just leaving while 1...everything goes haywire :-/ ...thanks anywaysSiao did an excellent magnifier in example scripts, and I think Nahuel diod one too. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Aceguy Posted November 20, 2008 Share Posted November 20, 2008 how about my prog iposted. expandcollapse popupinclude<WindowsConstants.au3> ;zoomit Opt("GUIOnEventMode", 1) $x_s = 0 $ry = 0 $rowx = 200 Dim $row_x[$rowx + 1] $Zi = GUICreate("Zoom", 400, 250, 320, 300, -1, BitOR($WS_EX_TOOLWINDOW, $WS_EX_TOPMOST)) $lbl = GUICtrlCreateLabel("", 250, 5, 75, 25) $clr1 = GUICtrlCreateLabel("", 5, 125, 100, 50) $got_clr=GUICtrlCreateLabel("",150,150,50,50) GUICtrlSetBkColor(-1,0x000000) $jmp_x = 0 $jmp_y = 0 For $x = 1 To $rowx $row_x[$x] = GUICtrlCreateLabel("", 2 + $x_s + $jmp_x, 2 + $ry + $jmp_y, 10, 10) GUICtrlSetBkColor($row_x[$x], 0xff0000) If IsInt($x / 20) Then $ry += 10 $x_s = -10 EndIf $x_s += 10 If $x_s=100 Then $jmp_x = 1 Else $jmp_x = 0 EndIf If $ry=50 Then $jmp_y = 1 Else $jmp_y = 0 EndIf Next GUISetState(@SW_SHOW) While 1 $ms = MouseGetPos() GUICtrlSetData($lbl, "X " & $ms[0] & " Y " & $ms[1]) $py = 0 $px = 0 For $ms_x = 1 To $rowx GUICtrlSetBkColor($row_x[$ms_x], PixelGetColor($ms[0] + $px - 10, $ms[1] + $py - 5)) If $px = 10 And $py = 4 Then $pgc=PixelGetColor($ms[0] + $px - 10, $ms[1] + $py - 5) $hex=hex($pgc) $stlf=StringTrimLeft($hex,2) GUICtrlSetData($clr1, $pgc&" 0x"&$stlf) GUICtrlSetBkColor($got_clr,$pgc) EndIf If IsInt($ms_x / 20) Then $py += 1 $px = -1 EndIf $px += 1 Next Sleep(25) WEnd [u]My Projects.[/u]Launcher - not just for games & Apps (Mp3's & Network Files)Mp3 File RenamerMy File Backup UtilityFFXI - Realtime to Vana time Clock 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