获取按钮焦点在哪识别.ahk
; https://www.autohotkey.com/boards/viewtopic.php?f=76&t=23541 ; Gui Destroy Gui, +hwndhGui Gui, Add, Edit, , Test stuff here ; Gui Add, Radio, w1 ; 处理默认焦点虚线问题 Loop, 10 if (A_Index = 5) ; 将按钮5设为默认值 Gui, Add, Button, vB%A_Index% +Default gBx, My Button %A_Index% else Gui, Add, Button, vB%A_Index% gBy, My Button %A_Index% Gui, Show return Esc:: GuiClose: ExitApp F4::Control, Check, , Button2, ahk_id %hGui% ; ControlFocus, Button1 F2::Reload F1:: DetectHiddenWindows On Out := "Control Text`tControl Style`n================================`n" WinGet, x, ControlListHwnd, ahk_id %hGui% Loop, Parse, x, `n, `r { ControlGetText, a,, ahk_id %A_LoopField% ControlGet, b, Style,,, ahk_id %A_LoopField% if (b & 0x1) Out .= " --> " Out .= a "`t" b "`n" } ToolTip, % Out return F3:: ; Gui Add, Button, hWndhBtn x62 y88 w75 h23 gTest, OK Test: ; https://www.autohotkey.com/boards/viewtopic.php?f=76&t=23543 ; SendMessage 0x6, 0, % hGui,, ahk_id %hGui% ; WM_ACTIVATE, WA_INACTIVE ; SendMessage 0x7, 0, 0 ,, ahk_id %hGui% ; WM_SETFOCUS ; https://www.autohotkey.com/boards/viewtopic.php?f=76&t=10517 ; Control Style, -0x1,, ahk_id%hBtn% ; BS_DEFPUSHBUTTON SendMessage 0x8, 0, 0,, ahk_id%hBtn% ; WM_KILLFOCUS ; SendMessage, 0x8, 0, 0, Button24, A ; WM_KILLFOCUS = 0x086 return Bx: ; MsgBox, Button 5 pressed! return By: ; MsgBox, Other button pressed... return
声明:站内资源为整理优化好的代码上传分享与学习研究,如果是开源代码基本都会标明出处,方便大家扩展学习路径。请不要恶意搬运,破坏站长辛苦整理维护的劳动成果。本站为爱好者分享站点,所有内容不作为商业行为。如若本站上传内容侵犯了原著者的合法权益,请联系我们进行删除下架。
评论(0)