home *** CD-ROM | disk | FTP | other *** search
/ Planet Source Code Jumbo …e CD Visual Basic 1 to 7 / 1_2002.ISO / Data / Zips / A_P_I__Too406631292001.psc / frmHwndScan.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  2001-12-07  |  4.7 KB  |  143 lines

  1. VERSION 5.00
  2. Begin VB.Form frmHwndScan 
  3.    BorderStyle     =   1  'Fixed Single
  4.    Caption         =   "Window Tools Professional - Handle Scanner"
  5.    ClientHeight    =   4815
  6.    ClientLeft      =   45
  7.    ClientTop       =   330
  8.    ClientWidth     =   5130
  9.    BeginProperty Font 
  10.       Name            =   "Tahoma"
  11.       Size            =   8.25
  12.       Charset         =   0
  13.       Weight          =   400
  14.       Underline       =   0   'False
  15.       Italic          =   0   'False
  16.       Strikethrough   =   0   'False
  17.    EndProperty
  18.    Icon            =   "frmHwndScan.frx":0000
  19.    LinkTopic       =   "Form1"
  20.    MaxButton       =   0   'False
  21.    MinButton       =   0   'False
  22.    ScaleHeight     =   4815
  23.    ScaleWidth      =   5130
  24.    StartUpPosition =   3  'Windows Default
  25.    Begin VB.CommandButton cmdScan 
  26.       Caption         =   "Scan"
  27.       Height          =   315
  28.       Left            =   3975
  29.       TabIndex        =   8
  30.       Top             =   4440
  31.       Width           =   1095
  32.    End
  33.    Begin VB.CommandButton cmdClear 
  34.       Caption         =   "Clear"
  35.       Height          =   315
  36.       Left            =   2820
  37.       TabIndex        =   7
  38.       Top             =   4440
  39.       Width           =   1155
  40.    End
  41.    Begin VB.Frame Frame1 
  42.       Caption         =   "Window Handle Scanner"
  43.       Height          =   1185
  44.       Left            =   90
  45.       TabIndex        =   1
  46.       Top             =   3180
  47.       Width           =   4965
  48.       Begin VB.TextBox txtTo 
  49.          Appearance      =   0  'Flat
  50.          Height          =   285
  51.          Left            =   2970
  52.          TabIndex        =   5
  53.          Top             =   750
  54.          Width           =   885
  55.       End
  56.       Begin VB.TextBox txtFrom 
  57.          Appearance      =   0  'Flat
  58.          Height          =   285
  59.          Left            =   1410
  60.          TabIndex        =   3
  61.          Top             =   750
  62.          Width           =   885
  63.       End
  64.       Begin VB.Label Label3 
  65.          Caption         =   "Enter a range of window handles and press 'Scan'.  Double-click on an item to show the properties in the main window."
  66.          Height          =   405
  67.          Left            =   180
  68.          TabIndex        =   6
  69.          Top             =   240
  70.          Width           =   4605
  71.       End
  72.       Begin VB.Label Label2 
  73.          AutoSize        =   -1  'True
  74.          Caption         =   "To:"
  75.          Height          =   195
  76.          Left            =   2670
  77.          TabIndex        =   4
  78.          Top             =   810
  79.          Width           =   240
  80.       End
  81.       Begin VB.Label Label1 
  82.          AutoSize        =   -1  'True
  83.          Caption         =   "From:"
  84.          Height          =   195
  85.          Left            =   900
  86.          TabIndex        =   2
  87.          Top             =   810
  88.          Width           =   480
  89.       End
  90.    End
  91.    Begin VB.ListBox lstWins 
  92.       Height          =   2985
  93.       Left            =   90
  94.       TabIndex        =   0
  95.       Top             =   90
  96.       Width           =   4965
  97.    End
  98. Attribute VB_Name = "frmHwndScan"
  99. Attribute VB_GlobalNameSpace = False
  100. Attribute VB_Creatable = False
  101. Attribute VB_PredeclaredId = True
  102. Attribute VB_Exposed = False
  103. Option Explicit
  104. Private Sub cmdClear_Click()
  105.     ' obvious...
  106.     lstWins.Clear
  107.     txtFrom.Text = ""
  108.     txtTo.Text = ""
  109. End Sub
  110. Private Sub cmdScan_Click()
  111.     Dim X As Double
  112.     Dim hwndlength As Long, WindowClass As Long
  113.     Dim FirstWindowText As String, SecondWindowText As String, StringBuffer As String
  114.     ' make sure the fool entered the right numbers...
  115.     If Val(txtFrom.Text) >= Val(txtTo.Text) Then
  116.         MsgBox "Please enter correct values for the 'From' and 'To' boxes.", vbExclamation, "Window Tools Professional"
  117.         Exit Sub
  118.     End If
  119.     ' loop that checks the window props, puts them in listbox
  120.     For X = Val(txtFrom.Text) To Val(txtTo.Text)
  121.         hwndlength = GetWindowTextLength(X)
  122.         FirstWindowText = String$(hwndlength, 0)
  123.         SecondWindowText = GetWindowText(X, FirstWindowText, (hwndlength + 1))
  124.         StringBuffer = String(250, 0)
  125.         WindowClass = GetClassName(X, StringBuffer, 250)
  126.         
  127.         lstWins.AddItem X & " - " & StringBuffer & " - " & FirstWindowText
  128.     Next X
  129. End Sub
  130. Private Sub lstWins_DblClick()
  131.     Dim DataSplit() As String
  132.     Dim ListData As String
  133.     ListData = lstWins.Text
  134.     ' splits up the data to be put on main screen
  135.     DataSplit = Split(ListData, " ")
  136.     ' user clicked nothing
  137.     If DataSplit(0) = "" Then
  138.         Exit Sub
  139.     End If
  140.     ' update the main window with the new "specs" on a window
  141.     WindowSpyUpdate (DataSplit(0))
  142. End Sub
  143.