|
-
Oct 11th, 2000, 05:06 PM
#1
Thread Starter
Addicted Member
How do I get the handle of all applications on the TaskBar?
-
Oct 11th, 2000, 05:17 PM
#2
-
Oct 11th, 2000, 05:23 PM
#3
Thread Starter
Addicted Member
That is where the first post went. I posted and couldn't find it in the general. Thanks Megatron.
-
Oct 11th, 2000, 05:24 PM
#4
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
-
Oct 11th, 2000, 05:25 PM
#5
Thread Starter
Addicted Member
But that retrieves all open windows. Do you know how to get ones only visible on the taskbar?
-
Oct 11th, 2000, 05:34 PM
#6
Fanatic Member
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
-
Oct 11th, 2000, 05:39 PM
#7
Thread Starter
Addicted Member
Thanks again Nitro. It works!
How can I use your example Escaflowne?
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
|