Jump to content

AZoom!


James
 Share

Recommended Posts

#cs
    Name: AZoom
    Author: James Brooks aka Secure_ICT
    Description: Zooms *2 under the mouse
#ce

#include <GUIConstants.au3>

HotKeySet("{ESC}", "Quit") ; We set a hotkey so we can exit

; Were making a 20x20 window
Global $GUI_Pixel[400]
Global $GUI = GUICreate("AZoom", 80, 80, @DesktopWidth / 2 * 1.84, @DesktopHeight / 4 * 3.418, $WS_POPUP + $WS_BORDER, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW)

; We now need to start a count so we can go through the script
$Count = 0

; Now we make lots of label which are 4x4. We do this so that we can later color them from what is under the mouse.
For $dX = 0 To 79 Step 4
    For $dY = 0 To 79 Step 4
        $GUI_Pixel[$Count] = GUICtrlCreateLabel("", $dX, $dY, 4, 4)
        $Count += 1
    Next
Next

GUISetState(@SW_SHOW)

Global $LPos[2] = [0, 0]

While 1
    $Count = 0
    $Pos = MouseGetPos() ; We need to get the mouse position, so we can call different arrays

; As we are magnifying a 20x20 section under the mouse
; We start with a negative number for each loop. This is strange but it still counts to 20x20
    For $dX = -10 To 9
        For $dY = -10 To 9
            GUICtrlSetBkColor($GUI_Pixel[$Count], PixelGetColor($Pos[0] + $dX, $Pos[1] + $dY))
            $Count += 1
        Next
    Next 
; Now that we have this, we can see animations under the mouse

; We sleep so that we dont use all our CPU usage
    Sleep(10)
WEnd

; We now make a function so that we can exit
Func Quit()
    Exit
EndFunc   ;==>Quit

This is another part of the ColorUnderMouse. I may merge them together to create a good script which, will show the colour and allow you to zoom on that pixel.

Screenshot:

The window looks like this:

http://www.autoitscript.com/fileman/users/public/Secure_ICT/example.JPG It sits in the bottom right of the desktop, I hope. I could only test it on a 1024x768 Resolution :rolleyes:

Edit: Added comments to the script as Manadar suggested :rambo:

Edited by Secure_ICT
Link to comment
Share on other sites

This is great but i have a few comments!

You should make it so it has multiple zooms, for instance 2x,3x,4x and the box should be much bigger than 20 x 20. also, the gui should follow the mouse around so when you put the mouse on something it zooms in on the target so you don't have to look at the bottom right all the time.

These suggestions are based on real programs that i've seen which do the same thing.

Link to comment
Share on other sites

This is great but i have a few comments!

You should make it so it has multiple zooms, for instance 2x,3x,4x and the box should be much bigger than 20 x 20. also, the gui should follow the mouse around so when you put the mouse on something it zooms in on the target so you don't have to look at the bottom right all the time.

These suggestions are based on real programs that i've seen which do the same thing.

like windows magnifier

nice program but you could work it more creating a real gui to setting the possetion of the window, and as sleepyXtreme said

you should add multiple zooms

Link to comment
Share on other sites

  • 1 month later...

Nice tool.

Hmm I read some of the comments and it seems that either James has left this or forgotten it.

Either way I have did some of the few thing people has requested. Though most of it does not work :).

I got the mouse wheel thing down,

(Please report if it works on your computer. Seems the return value is depending on some other factors which I do not know about. I used WinXP Home SP2 and it worked fine here.)

I just need to apply it to the zoom too. Only the text will change.

The time limit is because it seems if you scroll fast enough just will go below 0 and the program will crash. There there is a 150 milliseconds time limit.

I have also remove the "flicker". James updated it all the time even if there was no change, therefore there came flicker sometimes. I just stored the old pixel values and when it updates it compares to see if there is any changes. If not, no updating.

The gui resize is also a pain in the ass =X.

The small zoom view will not go out of the screen any more. It will just change position instead.

Also if the zoom window is not active it will not follow the mouse, yet still update.

I hope you don't mind what I have done James :P

For now, homework. But I will come back later.

(The code is a bit messy right now and no comments, sorry. Feel free to clean it up :))

#include <GUIConstants.au3>
#include <Misc.au3>

Global $GUIZOOM, $GUIINFO
Global $GUIWIDTH[2],$GUIHEIGHT[2],$GUIMINWIDTH[2],$GUIMINHEIGHT[2],$GUIMAXWIDTH[2],$GUIMAXHEIGHT[2]
$GUIWIDTH[0] = 80
$GUIHEIGHT[0] = 80
$GUIWIDTH[1] = 120
$GUIHEIGHT[1] = 150
$GUIMINWIDTH[0] = 80
$GUIMINHEIGHT[0] = 80
$GUIMAXWIDTH[0] = @DesktopWidth
$GUIMAXHEIGHT[0] = @DesktopHeight
Global $GUIZOOMSIZE = 0
Global $GUIZOOMSIZELABEL[19]
$GUIZOOMSIZELABEL[0]="1.00"
$GUIZOOMSIZELABEL[1]="1.20"
$GUIZOOMSIZELABEL[2]="1.40"
$GUIZOOMSIZELABEL[3]="1.60"
$GUIZOOMSIZELABEL[4]="1.80"
$GUIZOOMSIZELABEL[5]="2.00"
$GUIZOOMSIZELABEL[6]="2.25"
$GUIZOOMSIZELABEL[7]="2.50"
$GUIZOOMSIZELABEL[8]="2.75"
$GUIZOOMSIZELABEL[9]="3.00"
$GUIZOOMSIZELABEL[10]="4.00"
$GUIZOOMSIZELABEL[11]="5.00"
$GUIZOOMSIZELABEL[12]="6.00"
$GUIZOOMSIZELABEL[13]="7.00"
$GUIZOOMSIZELABEL[14]="8.00"
$GUIZOOMSIZELABEL[15]="9.00"
$GUIZOOMSIZELABEL[16]="10.00"
$GUIZOOMSIZELABEL[17]="11.00"
$GUIZOOMSIZELABEL[18]="12.00"
Global $GUIZOOMLABLE
Global $GUITEMPPIXEL[6400]
Global $SetZoomSizeTimeout = 150
Global $SetZoomSizeTime = $SetZoomSizeTimeout

HotKeySet("{ESC}", "Quit")

Global $GUI_Pixel[400]
Global $GUIZOOM = GUICreate("AZoom", $GUIWIDTH[0], $GUIHEIGHT[0], MouseGetPos(0)+10, MouseGetPos(1)+10, $WS_POPUP + $WS_SIZEBOX, $WS_EX_TOPMOST)
GUISetBkColor(0xFFFFFF)


$Count = 0

; Now we make lots of label which are 4x4. We do this so that we can later color them from what is under the mouse.
For $dX = 0 To 79 Step 4
    For $dY = 0 To 79 Step 4
        $GUI_Pixel[$Count] = GUICtrlCreateLabel("", $dX, $dY, 4, 4,-1)
        GUICtrlSetState(-1,$GUI_DISABLE)
        $Count += 1
    Next
Next

$GUIZOOMLABLE=GUICtrlCreateLabel("x1.0",2.5,67.5,32)
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
GUICtrlSetResizing(-1,$GUI_DOCKLEFT+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUISetState(@SW_SHOW)

AdlibEnable("UpdateZoom",10)
GUIRegisterMsg(0x020A ,"SetZoomSize")
GUIRegisterMsg(0x24, "SetGUIResize")

While 1
    Sleep(10)
WEnd

Func SetZoomSize($hWndGUI, $MsgID, $WParam, $LParam)
    If TimerDiff($SetZoomSizeTime) > $SetZoomSizeTimeout Then
        If $WParam = 0x00780000 And $GUIZOOMSIZE < 18 Then
            $GUIZOOMSIZE += 1
            GUICtrlSetData($GUIZOOMLABLE,"x"&$GUIZOOMSIZELABEL[$GUIZOOMSIZE])
        ElseIf $WParam = 0xFF880000 And $GUIZOOMSIZE > 0 Then
            $GUIZOOMSIZE -= 1
            GUICtrlSetData($GUIZOOMLABLE,"x"&$GUIZOOMSIZELABEL[$GUIZOOMSIZE])
        EndIf
        $SetZoomSizeTime = TimerInit()
    EndIf
EndFunc

Func UpdateZoom()
    $MouseTempPos = MouseGetPos()
    If WinActive($GUIZOOM)=1 And _IsPressed(01)=0 Then
        $GUITempMoveX = $MouseTempPos[0]+10
        $GUITempMoveY = $MouseTempPos[1]+10
        If $GUITempMoveX > @DesktopWidth-$GUIWIDTH[0]-10 Then
            $GUITempMoveX = $MouseTempPos[0]-$GUIWIDTH[0]-16
        EndIf
        If $GUITempMoveY > @DesktopHeight-$GUIHEIGHT[0]-10 Then
            $GUITempMoveY = $MouseTempPos[1]-$GUIHEIGHT[0]-16
        EndIf
        WinMove($GUIZOOM,"",$GUITempMoveX,$GUITempMoveY)
    EndIf

    $Count = 0

; As we are magnifying a 20x20 section under the mouse
; We start with a negative number for each loop. This is strange but it still counts to 20x20
    For $dX = -10 To 9
        For $dY = -10 To 9
            If $GUITEMPPIXEL[$Count] <> PixelGetColor($MouseTempPos[0] + $dX, $MouseTempPos[1] + $dY) Then
                GUICtrlSetBkColor($GUI_Pixel[$Count], PixelGetColor($MouseTempPos[0] + $dX, $MouseTempPos[1] + $dY))
                $GUITEMPPIXEL[$Count] = PixelGetColor($MouseTempPos[0] + $dX, $MouseTempPos[1] + $dY)
            EndIf
            $Count += 1
        Next
    Next
EndFunc

Func Quit()
    Exit
EndFunc

Func SetGUIResize($hWnd, $Msg, $wParam, $lParam)
    $DLLSTRUCT = DllStructCreate("int;int;int;int;int;int;int;int;int;int",$lParam)
    DllStructSetData($DLLSTRUCT,7,$GUIMINWIDTH[0])
    DllStructSetData($DLLSTRUCT,8,$GUIMINHEIGHT[0])
    DllStructSetData($DLLSTRUCT,9,$GUIMAXWIDTH[0])
    DllStructSetData($DLLSTRUCT,10,$GUIMAXHEIGHT[0])
    Return 0
EndFunc
Edited by Mr. Zero
Link to comment
Share on other sites

Nice work Mr.Zero, although magnifying doesn't work :P

Windows XP Pro SP2

Hmm as in zooming in and out or just displays the white background?

Zooming in and out has not been implemented yet. Which, I hope, will come in time.

I haven't touch the magnifying. No variables has been renamed or changed.

Function is as the one you made. Blame yourself :)

Funny, works perfect for me.

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...