⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 form1.frm

📁 Autocomplete sugestion textbox from Google, yahoo, youtube, wikipedia. in visual basic
💻 FRM
字号:
VERSION 5.00
Begin VB.Form Form1 
   BackColor       =   &H00FFFFFF&
   BorderStyle     =   4  'Fixed ToolWindow
   Caption         =   " Buscar"
   ClientHeight    =   630
   ClientLeft      =   150
   ClientTop       =   420
   ClientWidth     =   5550
   Icon            =   "Form1.frx":0000
   LinkTopic       =   "Form1"
   MaxButton       =   0   'False
   MinButton       =   0   'False
   ScaleHeight     =   630
   ScaleWidth      =   5550
   StartUpPosition =   2  'CenterScreen
   Begin VB.CommandButton CmdOption 
      Caption         =   "6"
      BeginProperty Font 
         Name            =   "Webdings"
         Size            =   12
         Charset         =   2
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   4330
      TabIndex        =   2
      Top             =   120
      Width           =   375
   End
   Begin VB.CommandButton Command1 
      Caption         =   "Go >"
      Default         =   -1  'True
      Height          =   375
      Left            =   4815
      TabIndex        =   1
      Top             =   120
      Width           =   615
   End
   Begin VB.TextBox Text1 
      BeginProperty Font 
         Name            =   "Times New Roman"
         Size            =   14.25
         Charset         =   0
         Weight          =   400
         Underline       =   0   'False
         Italic          =   0   'False
         Strikethrough   =   0   'False
      EndProperty
      Height          =   375
      Left            =   480
      TabIndex        =   0
      Top             =   120
      Width           =   3855
   End
   Begin VB.Shape Shape1 
      BorderColor     =   &H00CCCCCC&
      Height          =   375
      Left            =   120
      Shape           =   4  'Rounded Rectangle
      Top             =   120
      Width           =   495
   End
   Begin VB.Image Image1 
      Height          =   240
      Left            =   180
      Picture         =   "Form1.frx":628A
      Top             =   195
      Width           =   240
   End
   Begin VB.Menu MnuBuscadores 
      Caption         =   "Buscadores"
      Visible         =   0   'False
      Begin VB.Menu SubMnuBuscadores 
         Caption         =   "Google"
         Checked         =   -1  'True
         Index           =   0
      End
      Begin VB.Menu SubMnuBuscadores 
         Caption         =   "Yahoo"
         Index           =   1
      End
      Begin VB.Menu SubMnuBuscadores 
         Caption         =   "YouTube"
         Index           =   2
      End
      Begin VB.Menu SubMnuBuscadores 
         Caption         =   "Wikipedia"
         Index           =   3
      End
   End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Declare Sub InitCommonControls Lib "comctl32.dll" ()
Private Declare Function SetErrorMode Lib "kernel32" (ByVal wMode As Long) As Long

Private Type tExtrucSearcher
    UrlSuggestions      As String           'URL donde se encuentran las Sugerencias
    UrlSearch           As String           'URL donde se realizan las b鷖quedas
    Icon                As StdPicture       'Im醙en representativa
End Type
    
Private tSearcher(3)    As tExtrucSearcher
Private SearchIndex     As Long

Private Sub CmdOption_Click()
PopupMenu MnuBuscadores, , CmdOption.Left, CmdOption.Top + CmdOption.Height
End Sub

Private Sub Command1_Click()
    ShellExecute Me.hwnd, vbNullString, tSearcher(SearchIndex).UrlSearch & Text1, vbNullString, vbNullString, 1
End Sub

Private Sub Form_Initialize()
    InitCommonControls
    SetErrorMode &H2
End Sub

Private Sub Form_Load()
    With tSearcher(0) '========GOOGLE=========
        .UrlSuggestions = "http://suggestqueries.google.com/complete/search?output=firefox&client=firefox&hl={locale}&q={searchTerms}"
        .UrlSearch = "http://www.google.com/search?q="
        Set .Icon = LoadPicture(App.Path & "\Google.gif")
    End With
    
    With tSearcher(1) '========YAHOO=========
        .UrlSuggestions = "http://ff.search.yahoo.com/gossip?output=fxjson&command={searchTerms}"
        .UrlSearch = "http://ar.search.yahoo.com/search?p=" '!!!!attention "ar" is Argentina
        Set .Icon = LoadPicture(App.Path & "\Yahoo.gif")
    End With
    
    With tSearcher(2) '========YOUTUBE=========
        .UrlSuggestions = "http://suggestqueries.google.com/complete/search?output=firefox&client=firefox&&ds=yt&hl={locale}&q={searchTerms}"
        .UrlSearch = "http://www.youtube.com/results?search_type=&search_query="
        Set .Icon = LoadPicture(App.Path & "\YouTube.gif")
    End With
    
    With tSearcher(3) '========WIKIPEDIA=========
        .UrlSuggestions = "http://es.wikipedia.org/w/api.php?action=opensearch&search={searchTerms}"
        .UrlSearch = "http://es.wikipedia.org/wiki/Special:Search?search=" '!!!!attention "es" is Espa馻
        Set .Icon = LoadPicture(App.Path & "\Wikipedia.gif")
    End With
    
    SubMnuBuscadores_Click 0
    
    SubClassEdit Text1.hwnd
    
End Sub

Private Sub Form_Unload(Cancel As Integer)
    Call StopSubClass
End Sub


Private Sub SubMnuBuscadores_Click(Index As Integer)
Dim i As Integer

For i = 0 To 3
    SubMnuBuscadores(i).Checked = Index = i
Next


SearchIndex = Index

mSearcherOfSuggestions = tSearcher(Index).UrlSuggestions

Image1.Picture = tSearcher(Index).Icon

End Sub

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -