ok


OK. Here is a demo. Open a new project. Add Form1 with Command1 and Text1 (multiline and vscroll). Add Module1. Paste following code.

To Form1:

Code:

Private Sub Command1_Click()
Text1 = vbNullString
EnumWindows GetFunctionAddress(AddressOf EnumWindowsProc), 0&

End Sub

To Module1:

Code:

Public Declare Function EnumWindows Lib “user32” ( _
ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long

Public Declare Function EnumChildWindows Lib “user32″ ( _
ByVal hWndParent As Long, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long

Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Boolean
Form1.Text1 = Form1.Text1 & Str(hwnd) & vbCrLf
EnumChildWindows hwnd, GetFunctionAddress(AddressOf EnumChildProc), 0&
EnumWindowsProc = True

End Function

Public Function EnumChildProc(ByVal hwnd As Long, ByVal lParam As Long) As Boolean
Form1.Text1 = Form1.Text1 & ” ” & Str(hwnd) & vbCrLf
EnumChildProc = True

End Function

Public Function GetFunctionAddress(pAddress As Long) As Long
GetFunctionAddress = pAddress

End Function

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s