|
-
Feb 8th, 2001, 11:02 AM
#1
Hello;
Can someone tell me how to retrieve all the 'handles' of all the Windows.
-
Feb 8th, 2001, 11:26 AM
#2
Member
I personally haven`t tried this yet. 
But there is a web site that can help you.
http://www.allapi.net/
Plus, they have an API-Guide (with tons of examples, and a list of API Functions)....
.... and an API-Toolshed, a replacement for VB`s API Viewer utility.
(Download for FREE!)
Here is a start: EnumWindows API Function Call
The EnumWindows function enumerates all top-level windows on the screen by passing the handle of each window, in turn, to an application-defined callback function. EnumWindows continues until the last top-level window is enumerated or the callback function returns FALSE.
Search for this function on the site, they have an example.
Programmers dont byte, they just nibble a bit.
-
Feb 8th, 2001, 04:35 PM
#3
Add to a Module
Code:
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
Declare Function EnumWindows Lib "user32.dll" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
Public Function EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
Dim Length As Long
Dim sName As String
Dim Temp As String
Static iCount As Integer
iCount = iCount + 1
Length = GetWindowTextLength(hwnd) + 1
If Length > 1 Then
sName = Space(Length)
GetWindowText hwnd, sName, Length
Debug.Print Left(sName, Length - 1)
End If
EnumWindowsProc = 1
End Function
now use this line to display them (in the debug window)
Code:
'EnumWindows AddressOf EnumWindowsProc, 0
-
Feb 10th, 2001, 03:59 AM
#4
I prefer the FindWindowEx function. You can use this to enumerate all top level windows, and then plug in each of their handles to enumerate the lower level child windows and so on. Read up on it. I love this function. You can search by class or window name if you so choose, etc.
-
Feb 10th, 2001, 11:19 AM
#5
You can find the child windows but using the EnumChildwindows function.
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
|