Привел бы еще в пример WM_SETCURSOR:
global hBtn1, hBtn2, hBtn3
gui, add, button, w200 hwndhBtn1, Cursor hand
gui, add, button, w200 hwndhBtn2, Cursor help
gui, add, button, w200 hwndhBtn3, Cursor help and tooltip
gui, add, button, w200, Default button
gui, show
return
WM_SETCURSOR(wParam)
{
static init := OnMessage(0x20, "WM_SETCURSOR")
static IDC_APPSTARTING := 32650, IDC_ARROW := 32512, IDC_CROSS := 32515, IDC_HAND := 32649, IDC_HELP := 32651, IDC_IBEAM := 32513, IDC_ICON := 32641, IDC_NO := 32648, IDC_SIZE := 32640, IDC_SIZEALL := 32646, IDC_SIZENESW := 32643, IDC_SIZENS := 32645, IDC_SIZENWSE := 32642, IDC_SIZEWE := 32644, IDC_UPARROW := 32516, IDC_WAIT := 32514
switch (wParam)
{
case hBtn1:
{
setCursor(IDC_HAND)
}
case hBtn2:
{
setCursor(IDC_HELP)
}
case hBtn3:
{
tooltip, % "message"
setCursor(IDC_HELP)
}
default:
{
setCursor(IDC_ARROW)
toolTip
return false
}
}
return true
}
loadCursor(cursorId)
{
static IMAGE_CURSOR := 2, flags := (LR_DEFAULTSIZE := 0x40) | (LR_SHARED := 0x8000)
return DllCall("LoadImage", "Ptr", 0, "UInt", cursorId, "UInt", IMAGE_CURSOR, "Int", 0, "Int", 0, "UInt", flags, "Ptr")
}
setCursor(cursorIDC)
{
static cursorLoads := {}
if (!cursorLoads[cursorIDC])
{
cursorLoads[cursorIDC] := loadCursor(cursorIDC)
}
return DllCall("SetCursor", "Ptr", cursorLoads[cursorIDC])
}
Win10: LTSC (21H2); AHK: ANSI (v1.1.36.02)