Jump to content

Mouse Light


testingtest
 Share

Recommended Posts

Hello I tried making this project a while ago and never continued but it needs a bit of fixing but you'll get the whole point of it which is pretty cool.

If you are a admin or teacher and want people to watch you do stuff on the pc without them being distracted and help them not getting lost this is for you :P

test it ;)

pretty neat I don't feel like fixing it though

#include <GuiConstants.au3>
Const $RGN_AND = 1
Const $RGN_OR = 2
Const $RGN_XOR = 3
Const $RGN_DIFF = 4
Const $RGN_COPY = 5
Global $Min = 10 , $Add = 10 , $Width = 100 , $Height = 100 , $Switch 
HotKeySet("{ESC}" , "_Exit")
HotKeySet("{F10}" , "_Switch")
HotKeySet("{-}" , "Min")
HotKeySet("{+}" , "Add")

MsgBox(0 , "" , "to make width or height smaller -" & @CRLF & "to make width or height bigger +" & @CRLF & "to switch between width and height F10")

$GUI = GuiCreate("", @DesktopWidth , @DesktopHeight , -1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))
GUICtrlSetBkColor($GUI , 0xC0C0C0)
GuiSetState()
WinSetTrans($GUI , "" , 200)
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
EndSelect
Sleep(100)
$Pos = MouseGetPos()
_GuiHole($GUI , $Pos[0], $Pos[1] , $Width , $Height)
WEnd
Exit

Func _GuiHole($h_win, $i_x, $i_y, $i_sizew, $i_sizeh)
    Dim $pos, $outer_rgn, $inner_rgn, $wh, $combined_rgn
    $pos = WinGetPos($h_win)
    $outer_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", $pos[2], "long", $pos[3])
    $inner_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", $i_x, "long", $i_y, "long", $i_x + $i_sizew, "long", $i_y + $i_sizeh)
    $combined_rgn = DllCall("gdi32.dll", "long", "CreateRectRgn", "long", 0, "long", 0, "long", 0, "long", 0)
    DllCall("gdi32.dll", "long", "CombineRgn", "long", $combined_rgn[0], "long", $outer_rgn[0], "long", $inner_rgn[0], "int", $RGN_DIFF)
    DllCall("user32.dll", "long", "SetWindowRgn", "hwnd", $h_win, "long", $combined_rgn[0], "int", 1)
EndFunc

Func _Switch()
    If $Switch = 0 Then
        $Switch = 1 
    ElseIf $Switch = 1 Then
        $Switch = 0
    Else
        Exit
    EndIf
    Return $Switch
EndFunc

Func Min() 
    If $Switch = 0 Then 
        $Width = $Width - 10
    Else
        $Height = $Height - 10
    EndIf
    Return $Width & $Height
EndFunc

Func Add()
        If $Switch = 0 Then 
        $Width = $Width + 10
    Else
        $Height = $Height + 10
    EndIf
    Return $Width & $Height
EndFunc

Func _Exit()
    Exit
EndFunc
Edited by testingtest
Link to comment
Share on other sites

Very nice and good usage of GUIHole, if the box can move faster that would be great.

yea I added sleep(100) it can be removed but seemed better with it in there

I think if this does get popular I will finish it the reason for not finishing it is because I won't use it just an example of gui hole

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...