home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmFindPart
- BorderStyle = 3 'Fixed Dialog
- Caption = "Search Application Captions"
- ClientHeight = 3030
- ClientLeft = 1095
- ClientTop = 1485
- ClientWidth = 4875
- ForeColor = &H80000008&
- LinkTopic = "Form1"
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 3030
- ScaleWidth = 4875
- Begin VB.Frame frmResults
- Caption = "Last Results:"
- Height = 675
- Left = 240
- TabIndex = 8
- Top = 2160
- Width = 4335
- Begin VB.Label lblResults
- Caption = "lblResults"
- Height = 255
- Left = 120
- TabIndex = 9
- Top = 300
- Width = 4155
- End
- End
- Begin VB.CheckBox chkCase
- Caption = "C&ase Sensitive Comparisions"
- Height = 255
- Left = 300
- TabIndex = 6
- Top = 1740
- Width = 2715
- End
- Begin VB.Frame frmMethod
- Caption = "Search Method:"
- Height = 675
- Left = 240
- TabIndex = 2
- Top = 900
- Width = 4335
- Begin VB.OptionButton optMethod
- Caption = "&Matches"
- Height = 240
- Index = 2
- Left = 2850
- TabIndex = 5
- Top = 300
- Width = 1275
- End
- Begin VB.OptionButton optMethod
- Caption = "&Starts With"
- Height = 240
- Index = 0
- Left = 120
- TabIndex = 3
- Top = 300
- Width = 1275
- End
- Begin VB.OptionButton optMethod
- Caption = "&Contains"
- Height = 240
- Index = 1
- Left = 1470
- TabIndex = 4
- Top = 300
- Width = 1275
- End
- End
- Begin VB.CommandButton cmdActivate
- Caption = "&Activate"
- Default = -1 'True
- Height = 330
- Left = 3480
- TabIndex = 7
- Top = 1740
- Width = 1095
- End
- Begin VB.TextBox txtTitle
- BeginProperty Font
- Name = "MS Sans Serif"
- Size = 8.25
- Charset = 0
- Weight = 700
- Underline = 0 'False
- Italic = 0 'False
- Strikethrough = 0 'False
- EndProperty
- Height = 330
- Left = 270
- TabIndex = 1
- Text = "txtTitle"
- Top = 420
- Width = 4335
- End
- Begin VB.Label Label1
- Appearance = 0 'Flat
- AutoSize = -1 'True
- Caption = "Partial Window &Title:"
- ForeColor = &H80000008&
- Height = 195
- Left = 270
- TabIndex = 0
- Top = 180
- Width = 1455
- End
- Attribute VB_Name = "frmFindPart"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- ' *********************************************************************
- ' Copyright
- 1995-97 Karl E. Peterson, All Rights Reserved
- ' *********************************************************************
- ' You are free to use this code within your own applications, but you
- ' are expressly forbidden from selling or otherwise distributing this
- ' source code without prior written consent.
- ' *********************************************************************
- Option Explicit
- Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
- Private Sub cmdActivate_Click()
- Dim nRet As Long
- Dim Title As String
- ' Search using method user chose.
- nRet = AppActivatePartial(Trim(txtTitle.Text), _
- Val(frmMethod.Tag), CBool(chkCase.Value))
- If nRet Then
- lblResults.Caption = "Found: &&H" & Hex$(nRet)
- Title = Space$(256)
- nRet = GetWindowText(nRet, Title, Len(Title))
- If nRet Then
- lblResults.Caption = lblResults.Caption & _
- ", """ & Left$(Title, nRet) & """"
- End If
- Else
- lblResults.Caption = "Search Failed"
- End If
- End Sub
- Private Sub Form_Load()
- ' Setup controls.
- txtTitle.Text = ""
- lblResults.Caption = ""
- optMethod(0).Value = True
- End Sub
- Private Sub optMethod_Click(Index As Integer)
- ' Store selected Index, which just happens to
- ' coincide with method Enum, into frame's Tag.
- frmMethod.Tag = Index
- End Sub
-