枚举窗口内的子窗口句柄、类名

'Code By 魑魅魍魉
'mailto:DemonStudio@hotmail.com

Private Declare Function GetWindow Lib "user32" (ByVal hwnd As Long, ByVal wCmd As Long) As Long
Private Declare Function GetClassName Lib "user32" Alias "GetClassNameA" (ByVal hwnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As Long


Private Const GW_CHILD = 5
Private Const GW_HWNDNEXT = 2


Private Sub Form_Load()
Dim Hwd, Cla As Long
Dim Lon As String
Lon = Space(255)
Hwd = GetWindow(Me.hwnd, GW_CHILD)  '取得第1个子窗口句柄
Me.Caption = Hwd
Do While Hwd <> 0  '  如果句柄<>0循环
 Cla = GetClassName(Hwd, Lon, 255)   '取得这个子窗口的类名
 List1.AddItem Hwd & "   " & Trim$(Lon)  '将句柄和类名+到LIST1
 Hwd = GetWindow(Hwd, GW_HWNDNEXT)  '查找下一个
Loop
End Sub

阅读更多
个人分类: 源码
想对作者说点什么? 我来说一句

窗口操作辅助工具V1.3

2013年09月27日 1.76MB 下载

没有更多推荐了,返回首页

不良信息举报

枚举窗口内的子窗口句柄、类名

最多只允许输入30个字

加入CSDN,享受更精准的内容推荐,与500万程序员共同成长!
关闭
关闭