一个很陈旧却一直非常好用的API功能,请求高手指导下具体代码,非常感谢!!
一个很陈旧却一直非常好用的API功能,请求高手指导下具体代码,非常感谢!!
就是我找到了父窗口,请教如何遍历其全部子窗口?
我希望遍历到类名为:Internet Explorer_Server 的子窗口并将其最大化
我也知道这个大家都看的厌烦了,不过自己找的代码实在不好,希望能有高手高抬贵手几分钟贴个代码啊,非常感谢!!
(这个就是MDict的翻译部分,我的电脑的缘故不能最大化,是有个下拉条的 最大化才正常显示。)
[解决办法]
标准模块:
Option ExplicitPrivate Declare Function GetClassName Lib "user32.dll" Alias "GetClassNameA" (ByVal hWnd As Long, ByVal lpClassName As String, ByVal nMaxCount As Long) As LongPublic Declare Function EnumChildWindows Lib "user32.dll" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long'Public Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As BooleanPrivate Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As LongPrivate Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hWnd As Long) As LongPublic Function EnumChildWindowsProc(ByVal hWnd As Long, ByVal lParam As Long) As Boolean Dim WindowCaption As String, LengthCaption As Long, WindowClassName As String * 256 LengthCaption = GetWindowTextLength(hWnd) WindowCaption = Space(LengthCaption) Call GetWindowText(hWnd, WindowCaption, LengthCaption + 1) Call GetClassName(hWnd, WindowClassName, 256) WindowClassName = Left(WindowClassName, InStr(WindowClassName, Chr(0)) - 1) Form1.List1.AddItem "句柄:" & hWnd & " 标题:" & WindowCaption & " 类名:" & WindowClassName EnumChildWindowsProc = TrueEnd Function