Results 1 to 3 of 3

Thread: Getting all handles

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Canada
    Posts
    264

    Question

    I am trying to get ALL the handles of the currently running applications.
    In the beginning the universe was created. This has made a lot of people very angry and is generally regarded as a bad idea.

    - Douglas Adams
    The Hitchhiker's Guide to the Galaxy

  2. #2

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2000
    Location
    Canada
    Posts
    264
    O.K guys ... got it

    Thanks

    Alon
    In the beginning the universe was created. This has made a lot of people very angry and is generally regarded as a bad idea.

    - Douglas Adams
    The Hitchhiker's Guide to the Galaxy

  3. #3
    Matthew Gates
    Guest
    This code is excellent to use as well.


    Code:
    'Author: Megatron
    'Origin: http://www.vbforums.com
    'Purpose: List all window using the EnumWindows API function
    'Version: VB5+ 
    
    
    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
    
    
    Usage
    
    
    Private Sub Command1_Click()
        EnumWindows AddressOf EnumWindowsProc, 0
    End Sub

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width