www.pudn.com > windowsrunning > frmSelect.frm


VERSION 5.00 
Object = "{831FDD16-0C5C-11D2-A9FC-0000F8754DA1}#2.0#0"; "MSCOMCTL.OCX" 
Begin VB.Form frmSelect  
   BorderStyle     =   1  'Fixed Single 
   Caption         =   "Window Selection" 
   ClientHeight    =   7875 
   ClientLeft      =   45 
   ClientTop       =   330 
   ClientWidth     =   9555 
   Icon            =   "frmSelect.frx":0000 
   MaxButton       =   0   'False 
   ScaleHeight     =   7875 
   ScaleWidth      =   9555 
   StartUpPosition =   3  'Windows Default 
   Begin VB.CommandButton cmdAbout  
      Caption         =   "&About" 
      Height          =   555 
      Left            =   7260 
      TabIndex        =   39 
      Top             =   6960 
      Width           =   2235 
   End 
   Begin VB.CommandButton cmdTerminate  
      Caption         =   "Forcefully &Terminate Process" 
      Height          =   555 
      Left            =   7260 
      TabIndex        =   38 
      Top             =   5640 
      Width           =   2235 
   End 
   Begin VB.CommandButton cmdMouse  
      Caption         =   "&Select Window" 
      Height          =   555 
      Left            =   7260 
      TabIndex        =   9 
      Top             =   4320 
      Width           =   2235 
   End 
   Begin VB.Frame frameInfo  
      Caption         =   "Information on Currently Selected Item" 
      Height          =   2835 
      Left            =   60 
      TabIndex        =   6 
      Top             =   4680 
      Width           =   7035 
      Begin VB.TextBox txtWindRect  
         BackColor       =   &H00C0C0C0& 
         Height          =   315 
         Index           =   1 
         Left            =   5820 
         Locked          =   -1  'True 
         TabIndex        =   37 
         Top             =   2040 
         Width           =   1035 
      End 
      Begin VB.TextBox txtClientRect  
         BackColor       =   &H00C0C0C0& 
         Height          =   315 
         Index           =   1 
         Left            =   5820 
         Locked          =   -1  'True 
         TabIndex        =   36 
         Top             =   1680 
         Width           =   1035 
      End 
      Begin VB.TextBox txtOther  
         BackColor       =   &H00C0C0C0& 
         Height          =   315 
         Left            =   1440 
         Locked          =   -1  'True 
         TabIndex        =   35 
         Top             =   2400 
         Width           =   2115 
      End 
      Begin VB.TextBox txtClientRect  
         BackColor       =   &H00C0C0C0& 
         Height          =   315 
         Index           =   0 
         Left            =   4740 
         Locked          =   -1  'True 
         TabIndex        =   33 
         Top             =   1680 
         Width           =   1035 
      End 
      Begin VB.TextBox txtWndText  
         BackColor       =   &H00C0C0C0& 
         Height          =   315 
         Left            =   4740 
         Locked          =   -1  'True 
         TabIndex        =   32 
         Top             =   1320 
         Width           =   2115 
      End 
      Begin VB.TextBox txtThreadID  
         BackColor       =   &H00C0C0C0& 
         Height          =   315 
         Left            =   4740 
         Locked          =   -1  'True 
         TabIndex        =   31 
         Top             =   960 
         Width           =   2115 
      End 
      Begin VB.TextBox txtProcessID  
         BackColor       =   &H00C0C0C0& 
         Height          =   315 
         Left            =   4740 
         Locked          =   -1  'True 
         TabIndex        =   30 
         Top             =   600 
         Width           =   2115 
      End 
      Begin VB.TextBox txtWindRect  
         BackColor       =   &H00C0C0C0& 
         Height          =   315 
         Index           =   0 
         Left            =   4740 
         Locked          =   -1  'True 
         TabIndex        =   29 
         Top             =   2040 
         Width           =   1035 
      End 
      Begin VB.CheckBox chkEnabled  
         Enabled         =   0   'False 
         Height          =   315 
         Left            =   5280 
         TabIndex        =   28 
         Top             =   2400 
         Width           =   315 
      End 
      Begin VB.CheckBox chkVisible  
         Enabled         =   0   'False 
         Height          =   315 
         Left            =   4020 
         TabIndex        =   27 
         Top             =   2400 
         Width           =   255 
      End 
      Begin VB.TextBox txtProcessName  
         BackColor       =   &H00C0C0C0& 
         Height          =   315 
         Left            =   4740 
         Locked          =   -1  'True 
         TabIndex        =   21 
         Top             =   240 
         Width           =   2115 
      End 
      Begin VB.TextBox txtProgClass  
         BackColor       =   &H00C0C0C0& 
         Height          =   315 
         Left            =   1440 
         Locked          =   -1  'True 
         TabIndex        =   20 
         Top             =   2040 
         Width           =   2115 
      End 
      Begin VB.TextBox txtProghWnd  
         BackColor       =   &H00C0C0C0& 
         Height          =   315 
         Left            =   1440 
         Locked          =   -1  'True 
         TabIndex        =   19 
         Top             =   1680 
         Width           =   2115 
      End 
      Begin VB.TextBox txtParClass  
         BackColor       =   &H00C0C0C0& 
         Height          =   315 
         Left            =   1440 
         Locked          =   -1  'True 
         TabIndex        =   18 
         Top             =   1320 
         Width           =   2115 
      End 
      Begin VB.TextBox txtParhWnd  
         BackColor       =   &H00C0C0C0& 
         Height          =   315 
         Left            =   1440 
         Locked          =   -1  'True 
         TabIndex        =   17 
         Top             =   960 
         Width           =   2115 
      End 
      Begin VB.TextBox txtClass  
         BackColor       =   &H00C0C0C0& 
         Height          =   315 
         Left            =   1440 
         Locked          =   -1  'True 
         TabIndex        =   16 
         Top             =   600 
         Width           =   2115 
      End 
      Begin VB.TextBox txthWnd  
         BackColor       =   &H00C0C0C0& 
         Height          =   315 
         Left            =   1440 
         Locked          =   -1  'True 
         TabIndex        =   8 
         Top             =   240 
         Width           =   2115 
      End 
      Begin VB.Label lblEnabled  
         AutoSize        =   -1  'True 
         BackStyle       =   0  'Transparent 
         Caption         =   "Is Enabled" 
         Height          =   195 
         Left            =   5580 
         TabIndex        =   41 
         Top             =   2460 
         Width           =   750 
      End 
      Begin VB.Label lblVisible  
         AutoSize        =   -1  'True 
         BackStyle       =   0  'Transparent 
         Caption         =   "Is Visible" 
         Height          =   195 
         Left            =   4320 
         TabIndex        =   40 
         Top             =   2460 
         Width           =   615 
      End 
      Begin VB.Label lblOther  
         AutoSize        =   -1  'True 
         BackStyle       =   0  'Transparent 
         Caption         =   "Other Info:" 
         Height          =   195 
         Left            =   120 
         TabIndex        =   34 
         Top             =   2460 
         Width           =   750 
      End 
      Begin VB.Label lblWindRect  
         AutoSize        =   -1  'True 
         BackStyle       =   0  'Transparent 
         Caption         =   "Window Rect:" 
         Height          =   195 
         Left            =   3660 
         TabIndex        =   26 
         Top             =   2100 
         Width           =   1020 
      End 
      Begin VB.Label lblClientRect  
         AutoSize        =   -1  'True 
         BackStyle       =   0  'Transparent 
         Caption         =   "Client Rect:" 
         Height          =   195 
         Left            =   3660 
         TabIndex        =   25 
         Top             =   1740 
         Width           =   825 
      End 
      Begin VB.Label lblWindowText  
         AutoSize        =   -1  'True 
         BackStyle       =   0  'Transparent 
         Caption         =   "Window Text:" 
         Height          =   195 
         Left            =   3660 
         TabIndex        =   24 
         Top             =   1380 
         Width           =   990 
      End 
      Begin VB.Label LabelThreadID  
         AutoSize        =   -1  'True 
         BackStyle       =   0  'Transparent 
         Caption         =   "Thread ID:" 
         Height          =   195 
         Left            =   3660 
         TabIndex        =   23 
         Top             =   1020 
         Width           =   765 
      End 
      Begin VB.Label lblProcessID  
         AutoSize        =   -1  'True 
         BackStyle       =   0  'Transparent 
         Caption         =   "Process ID:" 
         Height          =   195 
         Left            =   3660 
         TabIndex        =   22 
         Top             =   660 
         Width           =   825 
      End 
      Begin VB.Label lblParhWnd  
         AutoSize        =   -1  'True 
         BackStyle       =   0  'Transparent 
         Caption         =   "Parent hWnd:" 
         Height          =   195 
         Left            =   120 
         TabIndex        =   15 
         Top             =   1020 
         Width           =   990 
      End 
      Begin VB.Label lblProghWnd  
         AutoSize        =   -1  'True 
         BackStyle       =   0  'Transparent 
         Caption         =   "Progenitor hWnd:" 
         Height          =   195 
         Left            =   120 
         TabIndex        =   14 
         Top             =   1740 
         Width           =   1245 
      End 
      Begin VB.Label lblProcess  
         AutoSize        =   -1  'True 
         BackStyle       =   0  'Transparent 
         Caption         =   "Process:" 
         Height          =   195 
         Left            =   3660 
         TabIndex        =   13 
         Top             =   300 
         Width           =   615 
      End 
      Begin VB.Label lblClass  
         AutoSize        =   -1  'True 
         BackStyle       =   0  'Transparent 
         Caption         =   "Class:" 
         Height          =   195 
         Left            =   120 
         TabIndex        =   12 
         Top             =   660 
         Width           =   420 
      End 
      Begin VB.Label lblParClass  
         AutoSize        =   -1  'True 
         BackStyle       =   0  'Transparent 
         Caption         =   "Parent Class:" 
         Height          =   195 
         Left            =   120 
         TabIndex        =   11 
         Top             =   1380 
         Width           =   930 
      End 
      Begin VB.Label lblProgClass  
         AutoSize        =   -1  'True 
         BackStyle       =   0  'Transparent 
         Caption         =   "Progenitor Class:" 
         Height          =   195 
         Left            =   120 
         TabIndex        =   10 
         Top             =   2100 
         Width           =   1185 
      End 
      Begin VB.Label lblhWnd  
         AutoSize        =   -1  'True 
         BackStyle       =   0  'Transparent 
         Caption         =   "hWnd:" 
         Height          =   195 
         Left            =   120 
         TabIndex        =   7 
         Top             =   300 
         Width           =   480 
      End 
   End 
   Begin VB.CommandButton cmdNext  
      Caption         =   "&Next --->" 
      Height          =   555 
      Left            =   7260 
      TabIndex        =   5 
      Top             =   6300 
      Width           =   2235 
   End 
   Begin MSComctlLib.ImageList imgListTreeView  
      Left            =   7680 
      Top             =   240 
      _ExtentX        =   1005 
      _ExtentY        =   1005 
      BackColor       =   -2147483643 
      ImageWidth      =   16 
      ImageHeight     =   16 
      MaskColor       =   12632256 
      _Version        =   393216 
      BeginProperty Images {2C247F25-8591-11D1-B16A-00C0F0283628}  
         NumListImages   =   4 
         BeginProperty ListImage1 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmSelect.frx":030A 
            Key             =   "Desktop" 
         EndProperty 
         BeginProperty ListImage2 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmSelect.frx":0466 
            Key             =   "Process" 
         EndProperty 
         BeginProperty ListImage3 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmSelect.frx":05C2 
            Key             =   "Thread" 
         EndProperty 
         BeginProperty ListImage4 {2C247F27-8591-11D1-B16A-00C0F0283628}  
            Picture         =   "frmSelect.frx":071E 
            Key             =   "Window" 
         EndProperty 
      EndProperty 
   End 
   Begin VB.CommandButton cmdEnum  
      Caption         =   "&Enumerate Windows" 
      Height          =   555 
      Left            =   7260 
      TabIndex        =   1 
      Top             =   4980 
      Width           =   2235 
   End 
   Begin MSComctlLib.TreeView TreeviewWindows  
      Height          =   4215 
      Left            =   60 
      TabIndex        =   0 
      Top             =   60 
      Width           =   9435 
      _ExtentX        =   16642 
      _ExtentY        =   7435 
      _Version        =   393217 
      HideSelection   =   0   'False 
      Indentation     =   476 
      LabelEdit       =   1 
      LineStyle       =   1 
      Sorted          =   -1  'True 
      Style           =   7 
      ImageList       =   "imgListTreeView" 
      Appearance      =   1 
   End 
   Begin VB.Label lblNOTE  
      AutoSize        =   -1  'True 
      Caption         =   "Please note that although a window belongs to a certain process, it's parent might be a window of another process." 
      Height          =   195 
      Left            =   120 
      TabIndex        =   42 
      Top             =   7620 
      Width           =   8115 
   End 
   Begin VB.Label lblCountProcess  
      BackStyle       =   0  'Transparent 
      Caption         =   "1" 
      Height          =   255 
      Left            =   5220 
      TabIndex        =   4 
      Top             =   4320 
      Width           =   2415 
   End 
   Begin VB.Label lblCountThreads  
      BackStyle       =   0  'Transparent 
      Caption         =   "1" 
      Height          =   255 
      Left            =   2700 
      TabIndex        =   3 
      Top             =   4320 
      Width           =   2415 
   End 
   Begin VB.Label lblCountWinds  
      BackStyle       =   0  'Transparent 
      Caption         =   "1" 
      Height          =   255 
      Left            =   120 
      TabIndex        =   2 
      Top             =   4320 
      Width           =   2415 
   End 
End 
Attribute VB_Name = "frmSelect" 
Attribute VB_GlobalNameSpace = False 
Attribute VB_Creatable = False 
Attribute VB_PredeclaredId = True 
Attribute VB_Exposed = False 
 Option Explicit 
' 
'  I have been to great troubles to learn all of the techniques in this program. 
'  I have spent many, many hours and late nights coding the many functions which I 
'  have included. As much as I resent it, Planet Source Code requires that I put 
'  the source code in the zip file. So I have placed it in here for you to view. 
'  Please use it wisely. And give me credit for all of the hard work that I have 
'  done. My biggest fear is that somebody will do an almost straight rip of this 
'  code, and take the credit for themselves. Please do not let this happening. I'm 
'  placing a lot of trust there. So please, use this program, use this code, and 
'  give me credit for it. If anybody rips all my routines, then my secret spy's 
'  (and I have a lot of them, as soon as I hire them) will tell me, and I'll get 
'  into my private jet (as soon as I buy it) and track you down over the whole 
'  world and eventually KILL YOU. You get the idea? Thanks. Read on for something 
'  a little more interesting! 
' 
' Code is Copyright Jolyon Bloomfield, February 2000 
' 
 
Public ReturnhWnd As Long 
 
Private Sub cmdAbout_Click() 
Dim TextString As String 
TextString = "WindowIt Version 1.0" & vbCrLf & _ 
    "Programmed Jan-March 2000 by Jolyon Bloomfield (Jolyon_B@Hotmail.Com)" & vbCrLf & _ 
    "Please read Readme.Txt for information on this program." & vbCrLf & _ 
    vbCrLf & _ 
    "Help: Click around to get the feel of how this application works. Is similar to Spy++ by Microsoft. Bug me to write a help files ;)" 
MsgBox TextString, vbInformation, "About WindowIt" 
End Sub 
 
Private Sub cmdEnum_Click() 
 
Dim Enumer As Enumerator 
Set Enumer = New Enumerator 
 
Enumer.EnumAll 
Enumer.EnumInTreeView frmSelect.TreeviewWindows, frmSelect.imgListTreeView, "Desktop", "Process", "Thread", "Window", Full 
 
lblCountWinds.Caption = "Number of Windows: " & Enumer.NumOfWinds 
lblCountWinds.Visible = True 
lblCountThreads.Caption = "Number of Threads: " & Enumer.NumOfThreads 
lblCountThreads.Visible = True 
lblCountProcess.Caption = "Number of Processes: " & Enumer.NumOfProcesses 
lblCountProcess.Visible = True 
 
UpdateInfo 
 
Set Enumer = Nothing 
 
End Sub 
 
Private Sub cmdMouse_Click() 
 
Dim Work As New Enumerator 
 
If TreeviewWindows.SelectedItem Is Nothing Then 
  ReturnhWnd = 0 
Else 
  Select Case TreeviewWindows.SelectedItem.Image 
    Case Is = "Desktop" 
      ReturnhWnd = Work.DesktopWind 
    Case Is = "Process" 
      ReturnhWnd = 0 
    Case Is = "Thread" 
      ReturnhWnd = 0 
    Case Is = "Window" 
      ReturnhWnd = Val(TreeviewWindows.SelectedItem.Tag) 
  End Select 
End If 
 
frmMouseSelect.DoStuph 
 
If ReturnhWnd = 0 Then Exit Sub 
 
If NodeExist(TreeviewWindows.Nodes, "_" & Work.Format8(ReturnhWnd)) Then 
Else 
  cmdEnum.Value = True 
End If 
On Error Resume Next 
TreeviewWindows.Nodes("_" & Work.Format8(ReturnhWnd)).Selected = True 
If Err Then MsgBox "The window currently being search for is not a valid window handle. Please try again.", vbCritical, "Error": TreeviewWindows.Nodes.Clear: Exit Sub 
TreeviewWindows_Click 
End Sub 
Private Sub cmdNext_Click() 
If TypeName(TreeviewWindows.SelectedItem) = "Nothing" Then beep: Exit Sub 
If Me.TreeviewWindows.SelectedItem.Image = "Window" Or Me.TreeviewWindows.SelectedItem.Image = "Desktop" Then 
Else 
  Exit Sub 
End If 
Dim hWnd As Long 
Dim MyEnum As Enumerator 
hWnd = Val(Me.TreeviewWindows.SelectedItem.Tag) 
Set MyEnum = New Enumerator 
If MyEnum.IsValidWindow(hWnd) = False Then MsgBox "It appears that the window that you have selected has been closed since the enumeration was performed. Please re-enumerate the windows, and try again.", vbInformation, "Error": Exit Sub 
Set MyEnum = Nothing 
frmProperty.LookHwnd = hWnd 
frmEdit.LookHwnd = hWnd 
'Me.Hide 
frmProperty.Show 
frmProperty.WindowState = vbNormal 
End Sub 
 
Private Sub cmdTerminate_Click() 
On Error GoTo Ender 
If Me.TreeviewWindows.SelectedItem.Image = "Process" Or Me.TreeviewWindows.SelectedItem.Image = "Thread" Or Me.TreeviewWindows.SelectedItem.Image = "Window" Then 
  Dim Temp As Enumerator 
  Dim GetProcess As Long 
  Set Temp = New Enumerator 
  On Error GoTo 0 
 
  ' Find the process selected 
  Do 
    If Me.TreeviewWindows.SelectedItem.Image = "Process" Then Exit Do 
    If Me.TreeviewWindows.SelectedItem.Image = "Desktop" Then Exit Sub 
    Set Me.TreeviewWindows.SelectedItem = Me.TreeviewWindows.SelectedItem.Parent 
  Loop 
  ' This is the process 
  GetProcess = Val(Me.TreeviewWindows.SelectedItem.Tag) 
 
  If MsgBox("Are you SURE you want to forcefully terminate the process """ & Temp.ProcessName(GetProcess) & """? Terminating the wrong process, especially a system process may result in the whole machine crashing. Do you wish to proceed?", vbCritical Or vbYesNo, "Terminate Process") = vbYes Then 
    If Temp.KillProcess(GetProcess) = False Then 
      MsgBox "Process was not terminated successfully", vbCritical, "Error" 
    Else 
      MsgBox "Process was successfully terminated.", vbInformation, "Process Terminated" 
    End If 
    cmdEnum.Value = True 
  End If 
Else 
beep:     Exit Sub 
End If 
Ender: 
End Sub 
 
Private Sub Form_Load() 
lblCountWinds.Visible = False 
lblCountThreads.Visible = False 
lblCountProcess.Visible = False 
Load frmEdit 
Load frmProperty 
Load frmMouseSelect 
Me.Show 
cmdEnum.Value = True 
End Sub 
 
Private Sub Form_Unload(Cancel As Integer) 
Dim Enumit As New Enumerator 
On Error Resume Next 
Me.TreeviewWindows.Nodes("_" & Enumit.Format8(Enumit.DesktopWind)).Expanded = False 
Me.TreeviewWindows.Nodes.Clear 
Dim i As Form 
For Each i In Forms 
  If i.Name = "frmMouseSelect" Then 
    Unload i 
  ElseIf i.Visible = False Then 
    Unload i 
  End If 
Next i 
End Sub 
 
Private Sub TreeviewWindows_Click() 
UpdateInfo 
End Sub 
 
Private Sub TreeviewWindows_DblClick() 
 
If TreeviewWindows.SelectedItem Is Nothing Then Exit Sub 
 
If TreeviewWindows.SelectedItem.Image = "Window" Then 
If TreeviewWindows.SelectedItem.Child Is Nothing Then cmdNext.Value = True 
End If 
 
End Sub 
 
Private Sub TreeviewWindows_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) 
On Error Resume Next 
If Button And &H1 = &H1 Then TreeviewWindows.HitTest(X, Y).Selected = True 
End Sub 
 
Private Function NodeExist(ByRef NodeCol As Nodes, ByVal ParentKey As String) 
 
Dim Dummy As String 
On Error Resume Next 
Dummy = NodeCol(ParentKey).Key 
If Err Then NodeExist = False Else NodeExist = True 
 
End Function 
 
Private Sub UpdateInfo() 
 
If TreeviewWindows.SelectedItem Is Nothing Then 
  With Me 
    .txtClass.Text = "" 
    .txtClientRect(0).Text = "" 
    .txtClientRect(1).Text = "" 
    .txtWindRect(0).Text = "" 
    .txtWindRect(1).Text = "" 
    .txthWnd.Text = "" 
    .txtParClass.Text = "" 
    .txtOther.Text = "" 
    .txtParhWnd.Text = "" 
    .txtProcessID.Text = "" 
    .txtProcessName.Text = "" 
    .txtProgClass.Text = "" 
    .txtProghWnd.Text = "" 
    .txtThreadID.Text = "" 
    .txtWndText.Text = "" 
    .chkEnabled.Value = 0 
    .chkVisible.Value = 0 
  End With 
  Exit Sub 
End If 
 
Dim Worker As New Enumerator 
Dim hWnd As Long 
Dim Use As RECT 
Dim Ender As RECT 
Dim Pointer As POINTAPI 
Dim WorkerText As String 
Dim XIncrement As Long 
Dim YIncrement As Long 
Dim Temper As Node 
 
Select Case TreeviewWindows.SelectedItem.Image 
    ' Desktop statistics and information 
  Case Is = "Desktop" 
    hWnd = Val(TreeviewWindows.SelectedItem.Tag) 
    With Me 
      .txthWnd.Text = Hex(hWnd) 
      .txtClass.Text = Worker.ClassName(hWnd) 
      .txtParhWnd.Text = Hex(Worker.ParentWind(hWnd)) 
      .txtParClass.Text = Worker.ClassName(Worker.ParentWind(hWnd)) 
      .txtProghWnd.Text = Hex(Worker.Progenitor(hWnd)) 
      .txtProgClass.Text = Worker.ClassName(Worker.Progenitor(hWnd)) 
      .txtProcessID.Text = Hex(Worker.WindProcess(hWnd)) 
      .txtThreadID.Text = Hex(Worker.WindThread(hWnd)) 
      .txtProcessName.Text = Worker.ProcessName(Worker.WindProcess(hWnd)) 
      .txtWndText.Text = Worker.GetWindText(hWnd) 
      .chkEnabled.Value = Abs(Worker.IsEnabled(hWnd)) 
      .chkVisible.Value = Abs(Worker.IsVisible(hWnd)) 
    End With 
    ' Get the Client Rectangles 
    Use = modConst.GetClientRects(hWnd) 
    Ender = modConst.GetWindowRects(hWnd) 
    With Use 
      ' Sort out the correct Client co-ordiantes, according to the parent. 
      Pointer.X = Use.Left 
      Pointer.Y = Use.Top 
      Pointer = modConst.ClientToScreen(hWnd, Pointer) 
      XIncrement = Pointer.X - Ender.Left 
      YIncrement = Pointer.Y - Ender.Top 
      WorkerText = "(" & Trim(Str(.Left + XIncrement)) & ", " & Trim(Str(.Top + YIncrement)) & ")-(" & Trim(Str(.Right + XIncrement)) & ", " & Trim(Str(.Bottom + YIncrement)) & ")" 
      ' Display them 
      Me.txtClientRect(0).Text = WorkerText 
      ' The client Size 
      Me.txtClientRect(1).Text = Trim(Str(.Right - .Left)) & " x " & Trim(Str(.Bottom - .Top)) 
    End With 
 
    ' Put the Window Rectangle Co-ordinates in the text boxes 
    Use = modConst.GetWindowRects(hWnd) 
    With Use 
      Me.txtWindRect(0).Text = "(" & Trim(Str(.Left)) & ", " & Trim(Str(.Top)) & ")-(" & Trim(Str(.Right)) & ", " & Trim(Str(.Bottom)) & ")" 
      Me.txtWindRect(1).Text = Trim(Str(.Right - .Left)) & " x " & Trim(Str(.Bottom - .Top)) 
    End With 
    Me.txtOther.Text = "This is the desktop window. " 
    If Worker.MenuHandle(hWnd) <> 0 Then Me.txtOther.Text = Me.txtOther.Text & "This window has a menu. " 
 
    ' Process statistics and information 
  Case Is = "Process" 
    Dim ProcessID As Long 
    ProcessID = Val(Me.TreeviewWindows.SelectedItem.Tag) 
    With Me 
      .txthWnd.Text = "" 
      .txtClass.Text = "" 
      .txtParhWnd.Text = "" 
      .txtParClass.Text = "" 
      .txtProghWnd.Text = "" 
      .txtProgClass.Text = "" 
      .txtProcessID.Text = Hex(ProcessID) 
      .txtThreadID.Text = "" 
      .txtProcessName.Text = Worker.ProcessName(ProcessID) 
      .txtWndText.Text = "" 
      .chkEnabled.Value = False 
      .chkVisible.Value = False 
      .txtClientRect(0).Text = "" 
      .txtClientRect(1).Text = "" 
      .txtWindRect(0).Text = "" 
      .txtWindRect(1).Text = "" 
      .txtOther.Text = "" 
    End With 
 
    ' Thread statistics and information 
  Case Is = "Thread" 
    Dim ThreadID As Long 
    ThreadID = Val(Me.TreeviewWindows.SelectedItem.Tag) 
    With Me 
      .txthWnd.Text = "" 
      .txtClass.Text = "" 
      .txtParhWnd.Text = "" 
      .txtParClass.Text = "" 
      .txtProghWnd.Text = "" 
      .txtProgClass.Text = "" 
      .txtProcessID.Text = Hex(Worker.ThreadProcess(ThreadID)) 
      .txtThreadID.Text = Hex(ThreadID) 
      .txtProcessName.Text = Worker.ProcessName(Worker.ThreadProcess(ThreadID)) 
      .txtWndText.Text = "" 
      .chkEnabled.Value = False 
      .chkVisible.Value = False 
      .txtClientRect(0).Text = "" 
      .txtClientRect(1).Text = "" 
      .txtWindRect(0).Text = "" 
      .txtWindRect(1).Text = "" 
      If Worker.ThreadHung(ThreadID) = False Then .txtOther.Text = "" Else .txtOther.Text = "This thread is HUNG!" 
    End With 
 
    ' Window statistics and information 
  Case Is = "Window" 
    hWnd = Val(TreeviewWindows.SelectedItem.Tag) 
    With Me 
      .txthWnd.Text = Hex(hWnd) 
      .txtClass.Text = Worker.ClassName(hWnd) 
      .txtParhWnd.Text = Hex(Worker.ParentWind(hWnd)) 
      .txtParClass.Text = Worker.ClassName(Worker.ParentWind(hWnd)) 
      .txtProghWnd.Text = Hex(Worker.Progenitor(hWnd)) 
      .txtProgClass.Text = Worker.ClassName(Worker.Progenitor(hWnd)) 
      .txtProcessID.Text = Hex(Worker.WindProcess(hWnd)) 
      .txtThreadID.Text = Hex(Worker.WindThread(hWnd)) 
      .txtProcessName.Text = Worker.ProcessName(Worker.WindProcess(hWnd)) 
      .txtWndText.Text = Worker.GetWindText(hWnd) 
      .chkEnabled.Value = Abs(Worker.IsEnabled(hWnd)) 
      .chkVisible.Value = Abs(Worker.IsVisible(hWnd)) 
    End With 
    ' Get the Client Rectangles 
    Use = modConst.GetClientRects(hWnd) 
    Ender = modConst.GetWindowRects(hWnd) 
    With Use 
      ' Sort out the correct Client co-ordiantes, according to the parent. 
      Pointer.X = Use.Left 
      Pointer.Y = Use.Top 
      Pointer = modConst.ClientToScreen(hWnd, Pointer) 
      XIncrement = Pointer.X - Ender.Left 
      YIncrement = Pointer.Y - Ender.Top 
      WorkerText = "(" & Trim(Str(.Left + XIncrement)) & ", " & Trim(Str(.Top + YIncrement)) & ")-(" & Trim(Str(.Right + XIncrement)) & ", " & Trim(Str(.Bottom + YIncrement)) & ")" 
      ' Display them 
      Me.txtClientRect(0).Text = WorkerText 
      ' The client Size 
      Me.txtClientRect(1).Text = Trim(Str(.Right - .Left)) & " x " & Trim(Str(.Bottom - .Top)) 
    End With 
 
    ' Put the Window Rectangle Co-ordinates in the text boxes 
    Use = modConst.GetWindowRects(hWnd) 
    With Use 
      Me.txtWindRect(0).Text = "(" & Trim(Str(.Left)) & ", " & Trim(Str(.Top)) & ")-(" & Trim(Str(.Right)) & ", " & Trim(Str(.Bottom)) & ")" 
      Me.txtWindRect(1).Text = Trim(Str(.Right - .Left)) & " x " & Trim(Str(.Bottom - .Top)) 
    End With 
    If Worker.DesktopWind = Worker.Progenitor(hWnd) Then Me.txtOther.Text = "This window is a child of the desktop. " Else Me.txtOther.Text = "" 
    If Worker.MenuHandle(hWnd) <> 0 Then Me.txtOther.Text = Me.txtOther.Text & "This window has a menu. " 
    Set Temper = Me.TreeviewWindows.SelectedItem 
    Do 
      If Temper.Image = "Process" Then 
        If Worker.ProcessName(Worker.WindProcess(Val(TreeviewWindows.SelectedItem.Tag))) <> Worker.ProcessName(Val(Temper.Tag)) Then 
          Me.txtOther.Text = Me.txtOther.Text & "This window belongs to a different process. " 
        End If 
        Exit Do 
      ElseIf Temper.Image = "Desktop" Then 
        Exit Do 
      Else 
        Set Temper = Temper.Parent 
      End If 
    Loop 
End Select 
 
End Sub 
 
Private Sub TreeviewWindows_NodeClick(ByVal Node As MSComctlLib.Node) 
UpdateInfo 
End Sub