Fossil Rock Posted September 27, 2007 Share Posted September 27, 2007 (edited) This isn't completed yet due to my lack of algorithm writing skillz and understanding of the DLLCall used in the magnification routine.It only works for 1x, 3x & 9x (1, 2 & 3 respectively on the numpad).expandcollapse popup; Example of zooming in on magnification area Orininal script @ http://www.autoitscript.com/forum/index.php?s=&showtopic=54080&view=findpost&p=409802 #include <A3LGDIPlus.au3> #Include <Misc.au3> Global Const $AC_SRC_ALPHA = 1 Global Const $ULW_ALPHA = 2 Global Const $c[9][2] = [[7,9],[0,0],[2,2],[0,0],[0,0],[0,0],[0,0],[0,0],[0,0]]; Correction bits for Magnification window placement $ZoomFactor = 1 ; Create GUI $hwnd = GUICreate("Zoom Zoom", 320, 220, -1, -1, -1, $WS_EX_TOPMOST) GUISetBkColor(0xFFFFFF) GUISetState() $MyhWnd = GUICreate("Zoom", 300, 200, 10, 10, BitOR($WS_CHILD, $WS_TABSTOP), -1, $hwnd) GUISetBkColor(0xFFFFFF, $MyhWnd) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect _Zoom_Factor() _Zoom($ZoomFactor) WEnd Func _Zoom_Factor(); Sets zoom factor ====== Only 1,3 & 9 work correctly ====== Select Case _IsPressed("61") $ZoomFactor = 1 ; Case _IsPressed("62") ; $ZoomFactor = 2 Case _IsPressed("62");63 $ZoomFactor = 3 ; Case _IsPressed("64") ; $ZoomFactor = 4 ; Case _IsPressed("65") ; $ZoomFactor = 5 ; Case _IsPressed("66") ; $ZoomFactor = 6 ; Case _IsPressed("67") ; $ZoomFactor = 7 ; Case _IsPressed("68") ; $ZoomFactor = 8 Case _IsPressed("63");69 $ZoomFactor = 9 EndSelect EndFunc Func _Zoom($zf); Modified from origial written by Larry, but he removed all his posts. Thanks anyway Larry. $pos = MouseGetPos() $a = $pos[0] $b = $pos[1] $MyHDC = DLLCall("user32.dll","int","GetDC","hwnd",$MyhWnd) If @error Then Return $DeskHDC = DLLCall("user32.dll","int","GetDC","hwnd",0) If Not @error Then $l = (($a - 140) + (140 * ($zf - 1)) / $zf) - $c[$zf-1][0] $t = (($b - 80) + (80 * ($zf - 1)) / $zf) - $c[$zf-1][1] DLLCall("gdi32.dll","int","StretchBlt","int",$MyHDC[0],"int", _ 0,"int",0,"int",300 * $zf,"int",200 * $zf,"int",$DeskHDC[0],"int", _ $l,"int",$t,"int",300,"int",200,"long",$SRCCOPY) EndIf DLLCall("user32.dll","int","ReleaseDC","int",$DeskHDC[0],"hwnd",0) DLLCall("user32.dll","int","ReleaseDC","int",$MyHDC[0],"hwnd",$MyhWnd) GUISetState() Sleep(20) EndFunc Edited September 27, 2007 by Fossil Rock Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
BrettF Posted September 27, 2007 Share Posted September 27, 2007 SCRIPT_PATH(10,16) : WARNING: $ZoomFactor possibly not declared/created yet $ZoomFactor = 1 ~~~~~~~~~~~~~~~^ SCRIPT_PATH(12,69) : WARNING: $hwnd possibly not declared/created yet $hwnd = GUICreate("Zoom Zoom", 320, 220, -1, -1, -1, $WS_EX_TOPMOST) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ SCRIPT_PATH(17,93) : WARNING: $MyhWnd possibly not declared/created yet $MyhWnd = GUICreate("MagItZoom", 300, 200, 10, 10, BitOR($WS_CHILD, $WS_TABSTOP), -1, $hwnd) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ SCRIPT_PATH(21,23) : WARNING: $msg possibly not declared/created yet $msg = GUIGetMsg() ~~~~~~~~~~~~~~~~~~~~~~^ SCRIPT_PATH(55,25) : WARNING: $pos possibly not declared/created yet $pos = MouseGetPos() ~~~~~~~~~~~~~~~~~~~~~~~~^ SCRIPT_PATH(56,17) : WARNING: $a possibly not declared/created yet $a = $pos[0] ~~~~~~~~~~~~~~~~^ SCRIPT_PATH(57,17) : WARNING: $b possibly not declared/created yet $b = $pos[1] ~~~~~~~~~~~~~~~~^ SCRIPT_PATH(58,64) : WARNING: $MyHDC possibly not declared/created yet $MyHDC = DLLCall("user32.dll","int","GetDC","hwnd",$MyhWnd) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ SCRIPT_PATH(60,64) : WARNING: $DeskHDC possibly not declared/created yet $DeskHDC = DLLCall("user32.dll","int","GetDC","hwnd",0) ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ SCRIPT_PATH(62,71) : WARNING: $l possibly not declared/created yet $l = (($a - 150) + (150 * ($zf - 1)) / $zf) - $c[$zf-1][0] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ SCRIPT_PATH(63,71) : WARNING: $t possibly not declared/created yet $t = (($b - 100) + (100 * ($zf - 1)) / $zf) - $c[$zf-1][1] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^ SCRIPT_PATH - 0 error(s), 11 warning(s) ->16:22:27 AU3Check ended.rc:1 >Running:(3.2.6.0):C:\Program Files\AutoIt3\autoit3.exe "SCRIPT_PATH" SCRIPT_PATH (10) : ==> Variable used without being declared.: $ZoomFactor = 1 ^ ERROR Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
Fossil Rock Posted September 27, 2007 Author Share Posted September 27, 2007 Check to see if you have all the includes. Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
BrettF Posted September 27, 2007 Share Posted September 27, 2007 Check to see if you have all the includes.Yes... I have them... Vist my blog!UDFs: Opens The Default Mail Client | _LoginBox | Convert Reg to AU3 | BASS.au3 (BASS.dll) (Includes various BASS Libraries) | MultiLang.au3 (Multi-Language GUIs!)Example Scripts: Computer Info Telnet Server | "Secure" HTTP Server (Based on Manadar's Server)Software: AAMP- Advanced AutoIt Media Player | WorldCam | AYTU - Youtube Uploader Tutorials: Learning to Script with AutoIt V3Projects (Hardware + AutoIt): ArduinoUseful Links: AutoIt 1-2-3 | The AutoIt Downloads Section: | SciTE4AutoIt3 Full Version! Link to comment Share on other sites More sharing options...
RazerM Posted September 27, 2007 Share Posted September 27, 2007 This is very nice! Very fast as well My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
Nahuel Posted September 27, 2007 Share Posted September 27, 2007 Haha, awesome! I love the effect it has when you move your mouse over the zoom window Link to comment Share on other sites More sharing options...
mattfaust Posted September 28, 2007 Share Posted September 28, 2007 ive tried a couple of these zoom scripts, and the image appears and follows the mouse but none of them zoom in. im using the lastest builds, any idea what is wrong? Link to comment Share on other sites More sharing options...
RazerM Posted September 28, 2007 Share Posted September 28, 2007 @mattfaust When the program starts, it is at 1x, press 2 or 3 to make it zoom. My Programs:AInstall - Create a standalone installer for your programUnit Converter - Converts Length, Area, Volume, Weight, Temperature and Pressure to different unitsBinary Clock - Hours, minutes and seconds have 10 columns each to display timeAutoIt Editor - Code Editor with Syntax Highlighting.Laserix Editor & Player - Create, Edit and Play Laserix LevelsLyric Syncer - Create and use Synchronised Lyrics.Connect 4 - 2 Player Connect 4 Game (Local or Online!, Formatted Chat!!)MD5, SHA-1, SHA-256, Tiger and Whirlpool Hash Finder - Dictionary and Brute Force FindCool Text Client - Create Rendered ImageMy UDF's:GUI Enhance - Enhance your GUIs visually.IDEA File Encryption - Encrypt and decrypt files easily! File Rename - Rename files easilyRC4 Text Encryption - Encrypt text using the RC4 AlgorithmPrime Number - Check if a number is primeString Remove - remove lots of strings at onceProgress Bar - made easySound UDF - Play, Pause, Resume, Seek and Stop. Link to comment Share on other sites More sharing options...
mattfaust Posted September 28, 2007 Share Posted September 28, 2007 i have , nothing happens Link to comment Share on other sites More sharing options...
Richard Robertson Posted September 28, 2007 Share Posted September 28, 2007 I'm curious, why by 3? Why not use a power of 2 like computers are based? 1, 2, 4, 8, etc. Nice work though, it's fun to play with. Link to comment Share on other sites More sharing options...
Fossil Rock Posted September 28, 2007 Author Share Posted September 28, 2007 I'm curious, why by 3? Why not use a power of 2 like computers are based? 1, 2, 4, 8, etc.Nice work though, it's fun to play with.Reread the original post. Agreement is not necessary - thinking for one's self is! Link to comment Share on other sites More sharing options...
JustinReno Posted September 28, 2007 Share Posted September 28, 2007 If you don't have a numberpad then it won't work unless you change the _IsPressed Link to comment Share on other sites More sharing options...
_Kurt Posted September 29, 2007 Share Posted September 29, 2007 This is very nice, no flashing lagging or skipping, very smooth and fast. Great Work. Kurt Awaiting Diablo III.. Link to comment Share on other sites More sharing options...
Siao Posted September 29, 2007 Share Posted September 29, 2007 (edited) Nice. Suggestion - I would use WinSetTrans on the GUI. This way magnifier would magnify what's "behind" the GUI (magnifying magnifier is only good for fun ). And if you set it transparent enough, the user could see behind the GUI too, which is handy,as the GUI wouldn't get in the way. Also it would look better, especially if you add WS_EX_TOOLWINDOW style... But maybe that's just personal preference, and GUI window getting in the way wouldn't be that big of an issue if your display is larger than my 15'' Also on further inspection noticed that there's a memory leak - DC handles aren't being released, because the parameters for ReleaseDC call are mixed up (window handle should come first, then DC handle). Edited September 29, 2007 by Siao "be smart, drink your wine" Link to comment Share on other sites More sharing options...
Achilles Posted September 30, 2007 Share Posted September 30, 2007 Nice, I like this! I made it 200 pixels bigger on each side so I could have more fun with the mouse over the window. My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] 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