EnumChildWindows

機能
指定のスレッドに関連する子ウィンドウをリストアップする
Declare Function EnumChildWindows Lib "user32.dll" _
(ByVal hWndParent As Long, ByVal lpEnumFunc As Long, _
lParam As Any) As Long
Declare Function EnumChildWindows Lib "user32.dll" _
(ByVal hWndParent As Integer, ByVal lpEnumFunc As Integer, _
lParam As Integer) As Integer

BOOL EnumChildWindows(
HWND hWndParent,
WNDENUMPROC lpEnumFunc,
LPARAM lParam
);
引数
hWndParent

親ウィンドウのハンドル
lpEnumFunc
コールバック関数EnumChildProc()関数へのポインタ
lParam
コールバック関数に渡すユーザー定義のデータ
戻り値
正常終了のとき  nIndexで指定した項目に対する値
エラーのとき  0
備考
AddressOf演算子を使わなければならないので、Visual Basic 5以上が必要。
lParam As Anyの部分は lParam As ListBoxなどに変更して使う。
サンプル
ダウンロード(EnumChildWindows.lzh 1.73KB)

Private Sub Command1_Click()
Dim lParam As ListBox
Dim hDeskTop As Long

'デスクトップのハンドル所得
hDeskTop = GetDesktopWindow

With Me.List1
    .Clear
Set lParam = Me.List1

'関数の実行
Call EnumChildWindows(hDeskTop, AddressOf EnumChildProc, lParam)
End With
End Sub