Sign in to follow this  
Followers 0
Arterie

Hide mouse

6 posts in this topic

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

Share this post


Link to post
Share on other sites



_MouseTrap sucks

For example, I can double-click to get out of it. Or ctrl+ESC, Or ctrl+alt+del :D

Also, when the user alt-tabs away from the game, mouse is still trapped ... bleh

Share this post


Link to post
Share on other sites

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

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

 

Share this post


Link to post
Share on other sites

Thanks wolf this was exactly what i am looking for

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

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]

Share this post


Link to post
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
Sign in to follow this  
Followers 0