home *** CD-ROM | disk | FTP | other *** search
/ CD Shareware Magazine 1999 April / CD_Shareware_Magazine_31.iso / Free / Prg / FindPart.exe / FindPart5.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1998-03-02  |  5.1 KB  |  154 lines

  1. VERSION 5.00
  2. Begin VB.Form frmFindPart 
  3.    BorderStyle     =   3  'Fixed Dialog
  4.    Caption         =   "Search Application Captions"
  5.    ClientHeight    =   3030
  6.    ClientLeft      =   1095
  7.    ClientTop       =   1485
  8.    ClientWidth     =   4875
  9.    ForeColor       =   &H80000008&
  10.    LinkTopic       =   "Form1"
  11.    PaletteMode     =   1  'UseZOrder
  12.    ScaleHeight     =   3030
  13.    ScaleWidth      =   4875
  14.    Begin VB.Frame frmResults 
  15.       Caption         =   "Last Results:"
  16.       Height          =   675
  17.       Left            =   240
  18.       TabIndex        =   8
  19.       Top             =   2160
  20.       Width           =   4335
  21.       Begin VB.Label lblResults 
  22.          Caption         =   "lblResults"
  23.          Height          =   255
  24.          Left            =   120
  25.          TabIndex        =   9
  26.          Top             =   300
  27.          Width           =   4155
  28.       End
  29.    End
  30.    Begin VB.CheckBox chkCase 
  31.       Caption         =   "C&ase Sensitive Comparisions"
  32.       Height          =   255
  33.       Left            =   300
  34.       TabIndex        =   6
  35.       Top             =   1740
  36.       Width           =   2715
  37.    End
  38.    Begin VB.Frame frmMethod 
  39.       Caption         =   "Search Method:"
  40.       Height          =   675
  41.       Left            =   240
  42.       TabIndex        =   2
  43.       Top             =   900
  44.       Width           =   4335
  45.       Begin VB.OptionButton optMethod 
  46.          Caption         =   "&Matches"
  47.          Height          =   240
  48.          Index           =   2
  49.          Left            =   2850
  50.          TabIndex        =   5
  51.          Top             =   300
  52.          Width           =   1275
  53.       End
  54.       Begin VB.OptionButton optMethod 
  55.          Caption         =   "&Starts With"
  56.          Height          =   240
  57.          Index           =   0
  58.          Left            =   120
  59.          TabIndex        =   3
  60.          Top             =   300
  61.          Width           =   1275
  62.       End
  63.       Begin VB.OptionButton optMethod 
  64.          Caption         =   "&Contains"
  65.          Height          =   240
  66.          Index           =   1
  67.          Left            =   1470
  68.          TabIndex        =   4
  69.          Top             =   300
  70.          Width           =   1275
  71.       End
  72.    End
  73.    Begin VB.CommandButton cmdActivate 
  74.       Caption         =   "&Activate"
  75.       Default         =   -1  'True
  76.       Height          =   330
  77.       Left            =   3480
  78.       TabIndex        =   7
  79.       Top             =   1740
  80.       Width           =   1095
  81.    End
  82.    Begin VB.TextBox txtTitle 
  83.       BeginProperty Font 
  84.          Name            =   "MS Sans Serif"
  85.          Size            =   8.25
  86.          Charset         =   0
  87.          Weight          =   700
  88.          Underline       =   0   'False
  89.          Italic          =   0   'False
  90.          Strikethrough   =   0   'False
  91.       EndProperty
  92.       Height          =   330
  93.       Left            =   270
  94.       TabIndex        =   1
  95.       Text            =   "txtTitle"
  96.       Top             =   420
  97.       Width           =   4335
  98.    End
  99.    Begin VB.Label Label1 
  100.       Appearance      =   0  'Flat
  101.       AutoSize        =   -1  'True
  102.       Caption         =   "Partial Window &Title:"
  103.       ForeColor       =   &H80000008&
  104.       Height          =   195
  105.       Left            =   270
  106.       TabIndex        =   0
  107.       Top             =   180
  108.       Width           =   1455
  109.    End
  110. Attribute VB_Name = "frmFindPart"
  111. Attribute VB_GlobalNameSpace = False
  112. Attribute VB_Creatable = False
  113. Attribute VB_PredeclaredId = True
  114. Attribute VB_Exposed = False
  115. ' *********************************************************************
  116. '  Copyright 
  117. 1995-97 Karl E. Peterson, All Rights Reserved
  118. ' *********************************************************************
  119. '  You are free to use this code within your own applications, but you
  120. '  are expressly forbidden from selling or otherwise distributing this
  121. '  source code without prior written consent.
  122. ' *********************************************************************
  123. Option Explicit
  124. Private Declare Function GetWindowText Lib "user32" Alias "GetWindowTextA" (ByVal hWnd As Long, ByVal lpString As String, ByVal cch As Long) As Long
  125. Private Sub cmdActivate_Click()
  126.    Dim nRet As Long
  127.    Dim Title As String
  128.    ' Search using method user chose.
  129.    nRet = AppActivatePartial(Trim(txtTitle.Text), _
  130.           Val(frmMethod.Tag), CBool(chkCase.Value))
  131.    If nRet Then
  132.       lblResults.Caption = "Found: &&H" & Hex$(nRet)
  133.       Title = Space$(256)
  134.       nRet = GetWindowText(nRet, Title, Len(Title))
  135.       If nRet Then
  136.          lblResults.Caption = lblResults.Caption & _
  137.             ", """ & Left$(Title, nRet) & """"
  138.       End If
  139.    Else
  140.       lblResults.Caption = "Search Failed"
  141.    End If
  142. End Sub
  143. Private Sub Form_Load()
  144.    ' Setup controls.
  145.    txtTitle.Text = ""
  146.    lblResults.Caption = ""
  147.    optMethod(0).Value = True
  148. End Sub
  149. Private Sub optMethod_Click(Index As Integer)
  150.    ' Store selected Index, which just happens to
  151.    ' coincide with method Enum, into frame's Tag.
  152.    frmMethod.Tag = Index
  153. End Sub
  154.