vbAccelerator - Contents of code file: fTest.frm
VERSION 5.00
Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
Begin VB.Form fTest
Caption = "Enumerate Windows Tester"
ClientHeight = 3765
ClientLeft = 2835
ClientTop = 2340
ClientWidth = 6045
Icon = "fTest.frx":0000
LinkTopic = "Form1"
ScaleHeight = 3765
ScaleWidth = 6045
Begin VB.CommandButton cmdFInd
Caption = "&Find Window"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Left = 1320
TabIndex = 2
Top = 3300
Width = 1155
End
Begin ComctlLib.ListView lvwWindows
Height = 3075
Left = 60
TabIndex = 1
Top = 120
Width = 5895
_ExtentX = 10398
_ExtentY = 5424
View = 3
Arrange = 2
LabelEdit = 1
LabelWrap = -1 'True
HideSelection = 0 'False
_Version = 327682
ForeColor = -2147483640
BackColor = -2147483643
BorderStyle = 1
Appearance = 1
BeginProperty Font {0BE35203-8F91-11CE-9DE3-00AA004BB851}
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
NumItems = 4
BeginProperty ColumnHeader(1) {0713E8C7-850A-101B-AFC0-4210102A8DA7}
Key = ""
Object.Tag = ""
Text = "Title"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(2) {0713E8C7-850A-101B-AFC0-4210102A8DA7}
SubItemIndex = 1
Key = ""
Object.Tag = ""
Text = "Class"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(3) {0713E8C7-850A-101B-AFC0-4210102A8DA7}
SubItemIndex = 2
Key = ""
Object.Tag = ""
Text = "hWnd"
Object.Width = 2540
EndProperty
BeginProperty ColumnHeader(4) {0713E8C7-850A-101B-AFC0-4210102A8DA7}
SubItemIndex = 3
Key = ""
Object.Tag = ""
Text = "Visible"
Object.Width = 2540
EndProperty
End
Begin VB.CommandButton cmdGet
Caption = "&Get Windows"
BeginProperty Font
Name = "Tahoma"
Size = 8.25
Charset = 0
Weight = 400
Underline = 0 'False
Italic = 0 'False
Strikethrough = 0 'False
EndProperty
Height = 435
Left = 60
TabIndex = 0
Top = 3300
Width = 1155
End
Begin ComctlLib.ImageList ImageList1
Left = 5340
Top = 3120
_ExtentX = 1005
_ExtentY = 1005
BackColor = -2147483643
MaskColor = 12632256
_Version = 327682
End
End
Attribute VB_Name = "fTest"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Implements IEnumWindowsSink
Private Sub cmdFInd_Click()
Dim sR As String
sR = InputBox("Enter Caption of Window to Find, use % for wildcard
matching:", , "%Microsoft Visual Basic")
If Len(sR) > 0 Then
Dim cF As New cFindWIndow
cF.TitleToFind = sR
If cF.FindWindow Then
If (vbOK = MsgBox("Found: Click OK to bring to the front.",
vbOKCancel Or vbInformation)) Then
ActivateWindow cF.hWndFound
End If
End If
End If
End Sub
Private Sub cmdGet_Click()
EnumerateWindows Me
End Sub
Private Sub IEnumWindowsSink_EnumWindow(ByVal hwnd As Long, bStop As Boolean)
Dim itmX As ListItem
Set itmX = lvwWindows.ListItems.Add(, , WindowTitle(hwnd))
itmX.SubItems(1) = ClassName(hwnd)
itmX.SubItems(2) = hwnd
itmX.SubItems(3) = IsWindowVisible(hwnd)
End Sub
Private Property Get IEnumWindowsSink_Identifier() As Long
IEnumWindowsSink_Identifier = Me.hwnd
End Property
Private Sub lvwWindows_ColumnClick(ByVal ColumnHeader As ComctlLib.ColumnHeader)
Dim iOrder As ListSortOrderConstants
Dim i As Long
If (ColumnHeader.Tag = "") Then
iOrder = lvwAscending
Else
iOrder = lvwDescending
End If
For i = 1 To lvwWindows.ColumnHeaders.Count
If (i <> ColumnHeader.Index) Then
lvwWindows.ColumnHeaders(i).Tag = ""
Else
If (iOrder = lvwAscending) Then
lvwWindows.ColumnHeaders(i).Tag = "DESC"
Else
lvwWindows.ColumnHeaders(i).Tag = ""
End If
End If
Next i
lvwWindows.SortKey = ColumnHeader.Index - 1
lvwWindows.SortOrder = iOrder
lvwWindows.Sorted = True
End Sub
|
|