Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #AutoIt3Wrapper_Res_File_Add=C:\Path\To\Cursor.cur, rt_cursor, CURSOR
- ;Adjust the path so it points to your .cur or .ani file. "rt_cursor" is the resource-type and "CURSOR" the resource name (to identify it when using multiple resources).
- ;The script needs to be compiled to function correctly (resource can only be loaded from compiled .exe).
- #include <WindowsConstants.au3>
- #include <GUIConstants.au3>
- #include <Constants.au3>
- #include <WinAPI.au3>
- #include <WinAPIEx.au3>
- ; -Author: name22 (www.autoit.de)
- $hInstance = _WinAPI_GetModuleHandle("") ;Handle to the instance of this script.
- $hNewCur = _WinAPI_LoadImage($hInstance, "CURSOR", $IMAGE_CURSOR, 0, 0, 0) ;Load cursor from instance.
- $hWnd_GUI = GUICreate("Cursor", 400, 400)
- GUISetState()
- GUIRegisterMsg($WM_SETCURSOR, "_SetCursor") ;Called if cursor moves inside the GUI
- While True
- Switch GUIGetMsg()
- Case $GUI_EVENT_CLOSE
- ExitLoop
- EndSwitch
- WEnd
- GUIRegisterMsg($WM_SETCURSOR, "") ;De-register message
- _WinAPI_DestroyCursor($hNewCur) ;Delete resource from memory
- Func _SetCursor($hWnd, $iMsg, $wParam, $lParam)
- #forceref $hWnd, $iMsg, $wParam, $lParam
- If _WinAPI_LoWord($lParam) = 1 Then ;Cursor is in client-area
- _WinAPI_SetCursor($hNewCur) ;Set cursor
- Return 1 ;Return and allow further processing.
- EndIf
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement