Function Reference


GUISetCursor

Sets the mouse cursor icon for a GUI window.

GUISetCursor ( [cursorID [, override = 0 [, winhandle]]] )

Parameters

cursorID [optional] Cursor Id (See Remarks).
override [optional] Force the requested mouse cursor even when over controls (see below).
    $GUI_CURSOR_NOOVERRIDE (0) = (default) Don't override a control's default mouse cursor.
    $GUI_CURSOR_OVERRIDE (1) = override control's default mouse cursor.

Constants are defined in GUIConstantsEx.au3.
winhandle [optional] Windows handle as returned by GUICreate() (default is the previously used window).

Return Value

None.

Remarks

If the cursorID is invalid the standard arrow will be displayed.

Usually when you move the mouse cursor over an edit control or other control the mouse cursor changes shape. The "override" option allows you to force the requested mouse cursor to be shown at all times. Note: If you have changed a controls mouse cursor with GUICtrlSetCursor() then this control mouse cursor will always be shown.

For a list of valid cursor IDs see MouseGetCursor().
CursorId = 16 will hide the mouse cursor.

Related

GUICtrlSetCursor

Example

#include <GUIConstantsEx.au3>

Global $g_iIDC = -1, $g_iNewIDC = 0
Global $g_aArray = StringSplit("Hand|AppStarting|Arrow|Cross|Help|IBeam|Icon (obsolete)|No|" & _
                "Size (obsolete)|SizeAll|SizeNESW|SizeNS|SizeNWSE|SizeWE|UpArrow|Wait|None", "|", 2) ; The flag parameter is set to flag = 2 as we don't require the total count of the array.

Example()

Func Example()
        HotKeySet("{ESC}", "Increment")

        GUICreate("Press ESC to Increment", 400, 400, 0, 0)

        GUISetState(@SW_SHOW)

        While GUIGetMsg() <> $GUI_EVENT_CLOSE
                If $g_iNewIDC <> $g_iIDC Then
                        $g_iIDC = $g_iNewIDC
                        GUISetCursor($g_iIDC)
                EndIf
                ToolTip("GUI Cursor #" & $g_iIDC & " (" & $g_aArray[$g_iIDC] & ")")
        WEnd

        GUIDelete()
EndFunc   ;==>Example

Func Increment()
        $g_iNewIDC = $g_iIDC + 1
        If $g_iNewIDC > 16 Then $g_iNewIDC = 0
EndFunc   ;==>Increment