Results 1 to 7 of 7

Thread: Programs on Taskbar

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    247
    How do I get the handle of all applications on the TaskBar?
    Mako Shark
    Great White

  2. #2

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    247
    That is where the first post went. I posted and couldn't find it in the general. Thanks Megatron.
    Mako Shark
    Great White

  4. #4
    Guest
    This can do it...

    Code:
    Public Declare Function SeekWin Lib "user32" _
    Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As _
    Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
    
    Sub GetAllWin (HwndList() As Long)
      Dim c, hwdwin, cnt
      Do Until SeekWin(vbNull, c, vbNull, vbNull) = 0
        hwdwin = SeekWin(vbNull, c, vbNull, vbNull)
        cnt = cnt + 1
        ReDim HwndList(cnt) As Long
        HwndList (cnt) = hwdwin
        c = hwdwin
      Loop
    End Sub

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    247
    But that retrieves all open windows. Do you know how to get ones only visible on the taskbar?
    Mako Shark
    Great White

  6. #6
    Fanatic Member
    Join Date
    Jan 2000
    Location
    Nitro
    Posts
    633
    Hi Shark

    You can use the IsWindowVisible API.


    Code:
    Option Explicit
    
    Public Declare Function EnumWindows Lib "user32.dll" (ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long
    Private Declare Function GetWindowTextLength Lib "user32" Alias "GetWindowTextLengthA" (ByVal hwnd As Long) As Long
    Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
    Private Declare Function IsWindowVisible Lib "user32" (ByVal hwnd As Long) As Long
    Private Declare Function SetWindowText Lib "user32.dll" Alias "SetWindowTextA" (ByVal hwnd As Long, ByVal lpString As String) As Long
    
    Sub Main()
      Call EnumWindows(AddressOf p_EnumWindowsProc, 0)
    End Sub
    Public Function p_EnumWindowsProc(ByVal hwnd As Long, ByVal lParam As Long) As Long
      Dim str_Data As String
      Dim lng_Length As Long
      
      If IsWindowVisible(hwnd) <> 0 Then
          lng_Length = GetWindowTextLength(hwnd) + 1
          If lng_Length > 1 Then
              str_Data = Space(lng_Length)
              Call GetWindowText(hwnd, str_Data, lng_Length)
              Debug.Print Left(str_Data, lng_Length - 1)
          End If
      End If
      
      p_EnumWindowsProc = 1
    End Function
    [Edited by Nitro on 10-11-2000 at 06:47 PM]
    Chemically Formulated As:
    Dr. Nitro

  7. #7

    Thread Starter
    Addicted Member
    Join Date
    May 2000
    Posts
    247

    Smile Thanks again Nitro. It works!

    How can I use your example Escaflowne?
    Mako Shark
    Great White

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