If you want all the windows to be seperated by :: then you will need to dim w in the declarations, cause if its decalered inside the sub, eachtime w will be "" so it will erase the previous value so therefore
VB Code:
[B]Dim W As String[/B] Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal Lparam As Long) As Boolean Dim Strcaption As String, NSize As Long, i As Integer Dim astrDataItem() As String NSize& = GetWindowTextLength(hwnd&) Strcaption$ = Space$(NSize& + 1) If IsWindowVisible(hwnd&) = 1 Then Call GetWindowText(hwnd&, Strcaption$, Len(Strcaption$)) If Strcaption$ <> Chr$(0) Then W = W & "::" & Left$(Strcaption$, Len(Strcaption$) - 1) End If End If astrDataItem() = Split(W, "::") For i = 0 To UBound(astrDataItem) Form1.List1.AddItem astrDataItem(i) Next EnumWindowsProc = True End Function




Reply With Quote