home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Source Code / Visual Basic Source Code.iso / vbsource / hideac1r / search.frm (.txt) next >
Encoding:
Visual Basic Form  |  1999-08-18  |  6.1 KB  |  182 lines

  1. VERSION 5.00
  2. Object = "{EAB22AC0-30C1-11CF-A7EB-0000C05BAE0B}#1.1#0"; "SHDOCVW.DLL"
  3. Begin VB.Form frmSearch 
  4.    BorderStyle     =   3  'Fixed Dialog
  5.    Caption         =   "Search..."
  6.    ClientHeight    =   5775
  7.    ClientLeft      =   45
  8.    ClientTop       =   330
  9.    ClientWidth     =   7800
  10.    LinkTopic       =   "Form1"
  11.    MaxButton       =   0   'False
  12.    MinButton       =   0   'False
  13.    ScaleHeight     =   5775
  14.    ScaleWidth      =   7800
  15.    ShowInTaskbar   =   0   'False
  16.    StartUpPosition =   2  'CenterScreen
  17.    Begin VB.ComboBox cmbEngine 
  18.       Height          =   315
  19.       Left            =   240
  20.       Style           =   2  'Dropdown List
  21.       TabIndex        =   6
  22.       Top             =   5280
  23.       Width           =   2775
  24.    End
  25.    Begin VB.CommandButton Command4 
  26.       Caption         =   "Stop Search"
  27.       Height          =   375
  28.       Left            =   6480
  29.       TabIndex        =   5
  30.       Top             =   120
  31.       Width           =   1215
  32.    End
  33.    Begin VB.CommandButton Command2 
  34.       Caption         =   "Exit"
  35.       Height          =   375
  36.       Left            =   6240
  37.       TabIndex        =   4
  38.       Top             =   5250
  39.       Width           =   1335
  40.    End
  41.    Begin VB.Frame Frame1 
  42.       Caption         =   "Web Browser"
  43.       Height          =   4335
  44.       Left            =   120
  45.       TabIndex        =   2
  46.       Top             =   600
  47.       Width           =   7575
  48.       Begin SHDocVwCtl.WebBrowser WebBrowser1 
  49.          Height          =   3735
  50.          Left            =   240
  51.          TabIndex        =   3
  52.          Top             =   360
  53.          Width           =   7095
  54.          ExtentX         =   12515
  55.          ExtentY         =   6588
  56.          ViewMode        =   1
  57.          Offline         =   0
  58.          Silent          =   0
  59.          RegisterAsBrowser=   0
  60.          RegisterAsDropTarget=   1
  61.          AutoArrange     =   -1  'True
  62.          NoClientEdge    =   0   'False
  63.          AlignLeft       =   0   'False
  64.          ViewID          =   "{0057D0E0-3573-11CF-AE69-08002B2E1262}"
  65.          Location        =   "about:NavigationCanceled"
  66.       End
  67.    End
  68.    Begin VB.TextBox Text1 
  69.       Height          =   285
  70.       Left            =   1920
  71.       TabIndex        =   1
  72.       Top             =   165
  73.       Width           =   4335
  74.    End
  75.    Begin VB.CommandButton Command1 
  76.       Caption         =   "Search..."
  77.       Height          =   375
  78.       Left            =   120
  79.       TabIndex        =   0
  80.       Top             =   120
  81.       Width           =   1575
  82.    End
  83.    Begin VB.Label Label1 
  84.       Caption         =   "Search Engines"
  85.       Height          =   255
  86.       Left            =   240
  87.       TabIndex        =   7
  88.       Top             =   5040
  89.       Width           =   1815
  90.    End
  91. Attribute VB_Name = "frmSearch"
  92. Attribute VB_GlobalNameSpace = False
  93. Attribute VB_Creatable = False
  94. Attribute VB_PredeclaredId = True
  95. Attribute VB_Exposed = False
  96. Option Explicit
  97. Private Const WEBCRAWLER = "WebCrawler"
  98. Private Const ALTAVISTA = "AltaVista"
  99. Private Const YAHOOCOM = "Yahoo.com"
  100. Private Const YAHOOCOUK = "Yahoo.co.uk"
  101. Private Const HOTBOT = "HotBot"
  102. Private Sub cmbEngine_Click()
  103.     'Change some bits and pieces on the form to let the user know where they are browsing...
  104.     With Me
  105.         Select Case .cmbEngine.Text
  106.             Case "AltaVista"
  107.                 .Command1.Caption = "Search Altavista"
  108.                 .Frame1.Caption = "Browse AltaVista"
  109.             Case "HotBot"
  110.                 .Command1.Caption = "Search HotBot"
  111.                 .Frame1.Caption = "Browse HotBot"
  112.             Case "Yahoo.com"
  113.                 .Command1.Caption = "Search Yahoo"
  114.                 .Frame1.Caption = "Browse Yahoo"
  115.             Case "Yahoo.co.uk"
  116.                 .Command1.Caption = "Search Yahoo UK"
  117.                 .Frame1.Caption = "Browse Yahoo UK"
  118.             Case "WebCrawler"
  119.                 .Command1.Caption = "Search WebCrawler"
  120.                 .Frame1.Caption = "Browse WebCrawler"
  121.             Case Else
  122.                 MsgBox "Error detected in selecting search Engine"
  123.         End Select
  124.     End With
  125. End Sub
  126. Private Sub Command1_Click()
  127.     Dim searchURL As String
  128.     With Me
  129.         'Check for empty search string
  130.         If .Text1.Text = "" Then
  131.             MsgBox "Please select a keyword(s) to search for"
  132.             Exit Sub
  133.         End If
  134.         'Check for no search engine selected
  135.         If .cmbEngine.Text = "" Then
  136.             MsgBox "Please select your preferred Search Engine"
  137.             Exit Sub
  138.         End If
  139.                 
  140.         Select Case .cmbEngine.Text
  141.             Case "AltaVista"
  142.                 searchURL = "http://www.altavista.com/cgi-bin/query?q=" & .Text1.Text
  143.             Case "HotBot"
  144.                 searchURL = "http://www.hotbot.com/?MT=" & .Text1.Text
  145.             Case "Yahoo.com"
  146.                 searchURL = "http://search.yahoo.com/bin/search?p=" & Text1.Text
  147.             Case "Yahoo.co.uk"
  148.                 searchURL = "http://search.yahoo.co.uk/search/ukie?p=" & .Text1.Text
  149.             Case "WebCrawler"
  150.                 searchURL = "http://www.webcrawler.com/cgi-bin/WebQuery?searchText=" & .Text1.Text
  151.             Case Else
  152.                 MsgBox "Error detected in selecting search Engine"
  153.         End Select
  154.     End With
  155.     'Navigate to the selected search engine and keyword
  156.     WebBrowser1.Navigate searchURL
  157. End Sub
  158. Private Sub Command2_Click()
  159.     Unload Me
  160. End Sub
  161. Private Sub Command4_Click()
  162.     WebBrowser1.Stop
  163. End Sub
  164. Private Sub Form_Load()
  165.     Dim sURL As String
  166.     With Me
  167.         'Assign a default URL to the WebBrowser control or it errors
  168.         sURL = "http://www.yahoo.com"
  169.         .WebBrowser1.Navigate sURL
  170.         'Add items to search engine dropdown box
  171.         .cmbEngine.AddItem ALTAVISTA
  172.         .cmbEngine.AddItem HOTBOT
  173.         .cmbEngine.AddItem WEBCRAWLER
  174.         .cmbEngine.AddItem YAHOOCOM
  175.         .cmbEngine.AddItem YAHOOCOUK
  176.         'Reset form captions
  177.         .Command1.Caption = "Search"
  178.         .Frame1.Caption = "Browse"
  179.     End With
  180.         
  181. End Sub
  182.