gtechies

Hide the mouse cursor

5 posts in this topic

Hey, I am wondering how you hide the mouse cursor.

Ive seen the function GUISetCursor(16) which will hide the mouse cursor in a window (16 is the value for a blank cursor). However, I don't want it to just be inside a GUI and would like it to be whenever. It would be like the "Hide cursor while typing" only it hides the cursor at all times. I have also seen MouseGetCursor() which will get the value of the cursor, but I didn't see a MouseSetCursor()

Thanks,

GT

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

This should get you started

HotKeySet('{Esc}', 'End')


Global Const $USER32 = DllOpen("user32.dll")
Global Const $cDir = 'C:\Windows\Cursors' ; Cursor Dir for vista
;
Global Const $Cursor = $cDir & '\wagtail.ani' ;Cursor that it will change to
Global Const $CursorBack = $cDir & '\aero_arrow_l.cur'

MouseSetCursor($Cursor) ;Set Cursor

While 1
    Sleep(10)
WEnd

Func MouseSetCursor($nCursor)
    ;Load
    $cDll = DllCall($USER32, "hwnd", "LoadCursorFromFile", "str", $nCursor)
    If @error <> 0 Then Return
    ;Change
    DllCall($USER32, "int", "SetSystemCursor", "int", $cDll[0], "int", 32512)
    If @error <> 0 Then Return
EndFunc   ;==>MouseSetCursor

Func End()
    MouseSetCursor($CursorBack)
    Exit
EndFunc   ;==>End

Edit: Bad Local

I would just find a blank cursor

Edited by lordicast

[Cheeky]Comment[/Cheeky]

Share this post


Link to post
Share on other sites

Tray this:

#Include <WinAPI.au3>
_WinAPI_ShowCursor(False)

But this works only in a GUI.


[font=Helvetica, Arial, sans-serif][background=rgb(252, 252, 250)][/background][/font]

Share this post


Link to post
Share on other sites

Hello!

I use your script, but my problem is: when i replaced a cursor with an other one (blank), i cant change again, to the original one. So: i can change back one cursor, but it's not the original. I want to change back the cursor, what the user use, when he start my software. I can change it back, if the user use a profile for it. You can read a registry value, from this root: "HKEY_CURRENT_USER\Control Panel\Cursors". Its a REG_EXPAND_SZ value, called Arrow. But you cant read it, if its empty. I was looking for the windows default cursor, but i didn't find it in the Cursors root, in the Windows folder. Can you help me? Have you same idea for me? Whats the method for it?

*** I'm sorry, i know, my english is bad, but i hope, you understand everything! ***

Anzelm

Share this post


Link to post
Share on other sites

Try this

#Include <WinAPI.au3>

GuiCreate("",500,500)
GuiSetState()

_WinAPI_ShowCursor(False)

Sleep(5000)
_WinAPI_ShowCursor(True)
Sleep(5000)

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