|
-
Feb 10th, 2003, 09:12 PM
#1
Thread Starter
Lively Member
How to get a list of all windows
I am trying to get the name of a particular window but the title can change at the end like
CNI EDITORIAL - Daily vs CNI EDITORIAL - SUNDAY
So I was trying to get a list of all the windows so that I could compare the first part of the string??
THank Scott
-
Feb 10th, 2003, 11:03 PM
#2
Frenzied Member
Use the class name instead of window title.
-
Feb 12th, 2003, 12:46 AM
#3
Addicted Member
or... EnumWindows () in user32.dll.
-
Feb 12th, 2003, 05:21 AM
#4
Hyperactive Member
VB Code:
Private Sub Form_Load()
EnumWindows AddressOf EnumWindowsProc, ByVal 0&
End Sub
'module code
Declare Function EnumWindows Lib "user32" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Boolean
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 EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Boolean
Dim sSave As String, Ret As Long
Ret = GetWindowTextLength(hwnd)
sSave = Space(Ret)
GetWindowText hwnd, sSave, Ret + 1
If Not sSave = "" Then Form1.List1.AddItem sSave
EnumWindowsProc = True
End Function
There's a certain mystique when I speak, that you notice that it's sorta unique, cause you know it's me
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|