指定のスレッドに関連する子ウィンドウをリストアップする
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