VB中Enumchildwindow函数怎么用?

这个函数怎么用,详细点... 这个函数怎么用,详细点 展开
 我来答
hejian511
2011-11-26 · TA获得超过845个赞
知道大有可为答主
回答量:1559
采纳率:0%
帮助的人:1473万
展开全部
Private Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
【说明】
为指定的父窗口枚举子窗口
【返回值】
Long,非零表示成功,零表示失败
【参数表】
hWndParent ----- Long,欲枚举子窗口的父窗口的句柄
lpEnumFunc ----- Long,为每个子窗口调用的函数的指针。用AddressOf运算符获得函数在一个标准模块中的地址
lParam --------- Long,在枚举期间,传递给dwcbkd32.ocx定制控件之EnumWindows事件的值。这个值的含义是由程序员规定的。

示例
'Example Name:EnumChildWindows
'in a form
Private Sub Form_Load()
'KPD-Team 2000
'URL: http://www.allapi.net/
'E-Mail: KPDTeam@Allapi.net
Me.AutoRedraw = True
EnumChildWindows GetDesktopWindow, AddressOf EnumChildProc, ByVal 0&
End Sub
'in a module
Declare Function GetDesktopWindow Lib "user32" () As Long
Declare Function EnumChildWindows Lib "user32" (ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
Public Function EnumChildProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim sSave As String
'Get the windowtext length
sSave = Space$(GetWindowTextLength(hwnd) + 1)
'get the window text
GetWindowText hwnd, sSave, Len(sSave)
'remove the last Chr$(0)
sSave = Left$(sSave, Len(sSave) - 1)
If sSave <> "" Then Form1.Print sSave
'continue enumeration
EnumChildProc = 1
End Function
简尘邶凌春
2020-02-18 · TA获得超过3670个赞
知道大有可为答主
回答量:3082
采纳率:34%
帮助的人:402万
展开全部
Private
Declare
Function
EnumChildWindows
Lib
"user32"
Alias
"EnumChildWindows"
(ByVal
hWndParent
As
Long,
ByVal
lpEnumFunc
As
Long,
ByVal
lParam
As
Long)
As
Long
这是一个枚举子窗口的API函数,函数的第一个参数是父窗体的句柄,第二个参数是回调函数的指针,第三个参数是参数。
返回值不用
EnumChildWindows
Function
The
EnumChildWindows
function
enumerates
the
child
windows
that
belong
to
the
specified
parent
window
by
passing
the
handle
to
each
child
window,
in
turn,
to
an
application-defined
callback
function.
EnumChildWindows
continues
until
the
last
child
window
is
enumerated
or
the
callback
function
returns
FALSE.SyntaxBOOL
EnumChildWindows(
HWND
hWndParent,
WNDENUMPROC
lpEnumFunc,
LPARAM
lParam
);
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式