#Include <GUIConstantsEx.au3>
#Include <WinAPIEx.au3>
#Include <WindowsConstants.au3>
Global $hForm, $hCursor
$hForm = GUICreate('在按钮上使用自定义鼠标形状')
GUIRegisterMsg($WM_SETCURSOR, 'WM_SETCURSOR')
$Button1= GUICtrlCreateButton("按钮", 125, 40,125, 40)
GUISetState()
Do
$h = Random(100, 116, 1)
Sleep(50)
$hCursor = _WinAPI_LoadCursor(_WinAPI_GetModuleHandle(@SystemDir & '\user32.dll'), $h)
Until GUIGetMsg() = $GUI_EVENT_CLOSE
Func WM_SETCURSOR($hWnd, $iMsg, $wParam, $lParam)
Switch $hWnd
Case $hForm
_WinAPI_SetCursor($hCursor)
Return 1
EndSwitch
Return $GUI_RUNDEFMSG
EndFunc
|