Jump to content

Hide mouse


Recommended Posts

I want to hide my mouse because i want to make a little game and the mouse shouldnt be visible.

Maybe i could make it transparent or hide it behind the window.

MfG Arterie

#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate("")
GUISetBkColor(0xFFCC99)
GUISetState(@SW_SHOW)
Global $CHKMOUSE = 0
While 1
    $size = WinGetPos($Form1)
    $pos = MouseGetPos()
    if IsArray($pos) And IsArray($size) Then
    if $pos[0] >= $size[0] And $pos[0] <= ($size[0] + $size[2] ) And  _
    $pos[1] >= $size[1] And $pos[1] <= ($size[1] + $size[3]) Then
    ShowCursor(False)
    SetCapture($Form1)
    $CHKMOUSE = 1
    Else
    IF $CHKMOUSE = 1 Then 
    ShowCursor(True)
    ReleaseCapture()
    $CHKMOUSE = 0
    EndIf
    EndIf
    EndIf
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
    EndSwitch
WEnd

Func ReleaseCapture()
$DllCall = DllCall("user32.dll" , "int" , "ReleaseCapture")
Return $DllCall[0]
EndFunc
Func SetCapture($hWnd)
$DllCall = DllCall("user32.dll" , "hWnd" , "SetCapture","hWnd",$hWnd)
Return $DllCall[0]
EndFunc

Func ShowCursor($BOOL_bShow)
$DllCall = DllCall("user32.dll" , "int" , "ShowCursor","int",$BOOL_bShow)
Return $DllCall[0]
EndFunc

صرح السماء كان هنا

 

Link to comment
Share on other sites

As far as I can understand ShowCursor shows the cursor, but what are

SetCapture ReleaseCapture for?

Can someone explain?

Lets say I just want to hide the cursor for 3 seconds how do I do it? MY window Title is IrfanView?

This does not work:

Opt("WinTitleMatchMode", 4)     ;1=start, 2=subStr, 3=exact, 4=advanced, -1 to -4=Nocase
Sleep(3000)
$hWnd = WinGetHandle("[CLASS:IrfanView]")
DllCall("user32.dll" , "int" , "ShowCursor","int",False)
DllCall("user32.dll" , "hWnd" , "SetCapture","hWnd",$hWnd)
Sleep(3000)
DllCall("user32.dll" , "int" , "ShowCursor","int",True)
DllCall("user32.dll" , "int" , "ReleaseCapture")
Edited by goldenix
My Projects:[list][*]Guide - ytube step by step tut for reading memory with autoitscript + samples[*]WinHide - tool to show hide windows, Skinned With GDI+[*]Virtualdub batch job list maker - Batch Process all files with same settings[*]Exp calc - Exp calculator for online games[*]Automated Microsoft SQL Server 2000 installer[*]Image sorter helper for IrfanView - 1 click opens img & move ur mouse to close opened img[/list]
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...