;根据控件的句柄,获取控件的ClassNN  
;0x71e24需要你根据实际情况来更换成实际的测试值
MsgBox,,, % GetClassNNEx(0x71e24)
Return


; Flag: GA_PARENT = 1, GA_ROOT = 2, GA_ROOTOWNER  = 3
GetAncestor(hWnd, Flag := 2) {
    Return DllCall("GetAncestor", "Ptr", hWnd, "UInt", Flag)
}
GetClassNNEx(hWnd) {
    hAncestor := GetAncestor(hWnd)
    If (!hAncestor) {
        Return
    }

    WinGetClass BaseClass, ahk_id %hWnd%
    NN := 0

    WinGet ControlList, ControlListHwnd, % "ahk_id " . hAncestor
    Loop Parse, ControlList, `n
    {
        WinGetClass Class, ahk_id %A_LoopField%
        If (Class == BaseClass) {
            NN++
            If (A_LoopField == hWnd) {
                Return Class . NN
            }
        }
    }
}