Back to 9/96 How To: Power Windows
Up to Table of Contents
Ahead to 9/96 How To: Programming Windows

9/96 How To: Power Windows

Find the Hidden Windows

1 Private Function GetMasterList() As Integer

2 Dim WndHnd As Long

3 Dim WndTitle As String

4 Dim TextLen As Integer

5 WndHnd = GetWindow(frmTasks.hwnd, GW_HWNDFIRST)

6 While WndHnd <> 0

7 TextLen = GetWindowTextLength (WndHnd)

8 If TextLen > 0 Then

9 WndTitle = Space(TextLen + 1)

10 TextLen = GetWindowText(WndHnd, WndTitle, TextLen + 1)

11 lbTasks.AddItem Format(WndHnd) + ": " + WndTitle

12 Else

13 lbTasks.AddItem Format(WndHnd) + ": <no title>"

14 End If

15 GetMasterList = GetMasterList + 1

16 WndHnd = GetWindow(WndHnd, GW_HWNDNEXT)

17 Wend

18 End Function

This Windows 95/NT version of GetMasterList was written in 32-bit Visual Basic 4.0. (Numbers are for reference only.)

Declare Function GetWindow Lib "User32" (ByVal hwnd As

Long, ByVal wCmd As Long) As Long

Declare Function GetWindowTextLength Lib "User32" Alias

"GetWindowTextLengthA" (ByVal hwnd As Long) As Long

Declare Function GetWindowText Lib "User32" Alias

"GetWindowTextA" (ByVal hwnd As Long, ByVal lpString

As String, ByVal cch As Long) As Long

Public Const GW_HWNDFIRST = 0

Public Const GW_HWNDNEXT = 2

These Windows API function declarations and constant definitions apply to the Windows 95/NT version of the WinMag Task List.

Back to 9/96 How To: Power Windows
Up to Table of Contents
Ahead to 9/96 How To: Programming Windows