dim pubHwndArr() as long '这是全局变量(至少模块级,先redim(0))
'然后调用这个过程,传入MDI主窗体句柄
Public Sub GoEnable(hWndParent As Long)
Dim hWndChild As Long
hWndChild = GetWindow(hWndParent, GW_CHILD Or GW_HWNDFIRST)
Do While hWndChild <> 0
redim preserve pubHwndArr(ubound(pubhwndarr)+1)
pubHwndArr(ubound(pubhwndarr))=hWndChild
GoEnable hWndChild
hWndChild = GetWindow(hWndChild, GW_HWNDNEXT)
Loop
End Sub
搞完后,pubhwndarr()里就是所有的句柄了
在百度搜的!!