Kohr Posted October 25, 2006 Share Posted October 25, 2006 I am trying to use the code made by Larry (and others) that uses the magnifier. The main difference is that I want to use it like a function where I can turn it on/off. My current method stops using the magnifier but it leaves it on the screen. How can I get rid of it? Kohr example code expandcollapse popup#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Global $SRCCOPY = 0x00CC0020 Global $leave = 0 HotKeySet("{PAUSE}","leave") HotKeySet("{HOME}","MAG") $main = GUICreate("a",100,100) GUISetState() GUISetOnEvent($GUI_EVENT_CLOSE, "CloseClicked") While 1 Sleep(100) WEnd Func MAG() SplashTextOn ( "AU3MAG", "" , 100 , 100 , 0, 0, 1 ) $MyhWnd = WinGetHandle("AU3MAG") While Not $leave $MyHDC = DLLCall("user32.dll","int","GetDC","hwnd",$MyhWnd) If @error Then Return $DeskHDC = DLLCall("user32.dll","int","GetDC","hwnd",0) If Not @error Then $xy = MouseGetPos() If Not @error Then $l = $xy[0]-10 $t = $xy[1]-10 DLLCall("gdi32.dll","int","StretchBlt","int",$MyHDC[0],"int", _ 0,"int",0,"int",100,"int",100,"int",$DeskHDC[0],"int", _ $l,"int",$t,"int",20,"int",20,"long",$SRCCOPY) EndIf DLLCall("user32.dll","int","ReleaseDC","int",$DeskHDC[0],"hwnd",0) EndIf DLLCall("user32.dll","int","ReleaseDC","int",$MyHDC[0],"hwnd",$MyhWnd) WEnd Return EndFunc Func leave() $leave = 1 EndFunc Func CloseClicked() Exit EndFunc AutoIt LinksAutoIt CrapsGrid_PixelSearchAdvancedPixelGrab Link to comment Share on other sites More sharing options...
BigDod Posted October 25, 2006 Share Posted October 25, 2006 (edited) expandcollapse popup#include <GUIConstants.au3> Opt("GUIOnEventMode", 1) Global $SRCCOPY = 0x00CC0020 Global $leave = "" ; <------ Changed HotKeySet("{PAUSE}","leave") HotKeySet("{HOME}","MAG") $main = GUICreate("a",100,100) GUISetState() GUISetOnEvent($GUI_EVENT_CLOSE, "CloseClicked") While 1 Sleep(100) WEnd Func MAG() $Leave=0 ; <---- Added SplashTextOn ( "AU3MAG", "" , 100 , 100 , 0, 0, 1 ) $MyhWnd = WinGetHandle("AU3MAG") While Not $leave $MyHDC = DLLCall("user32.dll","int","GetDC","hwnd",$MyhWnd) If @error Then Return $DeskHDC = DLLCall("user32.dll","int","GetDC","hwnd",0) If Not @error Then $xy = MouseGetPos() If Not @error Then $l = $xy[0]-10 $t = $xy[1]-10 DLLCall("gdi32.dll","int","StretchBlt","int",$MyHDC[0],"int", _ 0,"int",0,"int",100,"int",100,"int",$DeskHDC[0],"int", _ $l,"int",$t,"int",20,"int",20,"long",$SRCCOPY) EndIf DLLCall("user32.dll","int","ReleaseDC","int",$DeskHDC[0],"hwnd",0) EndIf DLLCall("user32.dll","int","ReleaseDC","int",$MyHDC[0],"hwnd",$MyhWnd) WEnd Return EndFunc Func leave() $leave = 1 SplashOff() ; <------ Added EndFunc Func CloseClicked() Exit EndFunc Edit Modified to enable restarting magnify Edited October 25, 2006 by BigDod Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Kohr Posted October 25, 2006 Author Share Posted October 25, 2006 Thanks again BigDod. Works just like I needed. Kohr AutoIt LinksAutoIt CrapsGrid_PixelSearchAdvancedPixelGrab 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