通过控件句柄获取控件ClassNN Autohotkey

本文来自于Thinkai’s Blog,thinkai也是我在ahk上面的引路人,对thinkai感兴趣的朋友请关注他的博客。
thinkai的博客简洁、有趣,即便是转载过来我也尽量保持作者原有的风格,主要是方便大家查阅。
ControlGet, controlhwnd, hwnd, , , A ;获取控件hwnd
WinGet, mainhwnd, ID, A ;获取窗口hwnd
/*
VarSetCapacity(c,201,0)
DllCall("GetClassNameA","int",controlhwnd, "Ptr", &c, "Int", 200)  ;获取控件类
classname := StrGet(&c,200)
*/
WinGetClass, classname, ahk_id %controlhwnd%
nhwnd := 0, idx := 0
while nhwnd<>controlhwnd
{
idx++,nhwnd := DllCall("FindWindowExA","uint", mainhwnd, "uint", nhwnd, "Str", classname,"uint", 0) ;枚举该类控件,检查是否是这一个控件
if !nhwnd
break
}
classNN := classname idx

给TA捐赠
共{{data.count}}人
人已捐赠
其他教程

获取控件或窗口的父窗口 Autohotkey

2020-2-19 10:31:23

其他教程

获取http-only只读cookie Autohotkey

2020-2-19 10:32:40

2 条回复 A文章作者 M管理员
  1. aahk

    #SingleInstance Ignore
    #Persistent
    SetTimer,Timer1,500
    return
    Timer1()
    {
    ControlGet, controlhwnd, hwnd, , , A ;获取控件hwnd
    WinGet, mainhwnd, ID, A ;获取窗口hwnd
    /*
    VarSetCapacity(c,201,0)
    DllCall(“GetClassNameA”,”int”,controlhwnd, “Ptr”, &c, “Int”, 200) ;获取控件类
    classname := StrGet(&c,200)
    */
    WinGetClass, classname, ahk_id %controlhwnd%
    nhwnd := 0, idx := 0
    while nhwndcontrolhwnd
    {
    idx++,nhwnd := DllCall(“FindWindowExA”,”uint”, mainhwnd, “uint”, nhwnd, “Str”, classname,”uint”, 0) ;枚举该类控件,检查是否是这一个控件
    if !nhwnd
    break
    }
    classNN := classname idx

    ToolTip,%classNN%
    }

个人中心
购物车
优惠劵
有新私信 私信列表
搜索