Search the Internet with 8 common search engines!!

By | 2002-06-01

Search the internet for web pages or files from your VB App.
8 common search engines:
AltaVista, Excite, HotBot, Infoseek, Lycos, Yahoo, SoftSeek, AudioFind
An easy to use function.
You can add as many Search Engines to the Search-engine list as you want, this list contains 8 search-engines. One of my lists contain 24 common search-engines.
Use like this:
SearchTheWeb Inputbox(“Enter search-words:”,””,””), wAltaVista

Original Author: Hyperswede

Inputs

Just specify the search engine and words to search for.

Returns

Opens your web browser to a page showing the results of your search.

API Declarations

It’s all in the source code below.

Code

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
'The Search-Engine list:
Const SearchEngineList As String = "http://www.altavista.digital.com/cgi-bin/query?pg=q&what=web&fmt=.&q=||http://www.excite.com/search.gw?c=web&search=||http://www.hotbot.com/?SW=web&SM=MC&MT=||http://guide-p.infoseek.com/Titles?qt=|&col=WW&sv=IS&lk=noframes|http://www.lycos.com/cgi-bin/pursuit?query=||http://search.yahoo.com/bin/search?p=||http://search02.softseek.com/cgi-bin/search.cgi?keywords=|&seekindex=index&maxresults=025&cb=|http://www.audiofind.com:70/?audiofindsearch=|&audiofindtype="
Const wAltaVista As Long = 1
Const wExcite As Long = 3
Const wHotBot As Long = 5
Const wInfoseek As Long = 7
Const wLycos As Long = 9
Const wYahoo As Long = 11
Const wSoftSeek As Long = 13
Const wAudioFind As Long = 15
Function PartOfString(Str As String, Seperator As String, Number As Long)
Dim Current, Temp, Full
Current = 1
For q = 1 To Len(Str)
Temp = Mid(Str, q, 1)
If Temp = Seperator Then Current = Current + 1
If Current = Number And Not Temp = Seperator Then Full = Full & Temp
Next q
PartOfString = Full
End Function
Sub SearchTheWeb(ForWhat As String, WithWhat As Long)
ret& = ShellExecute(Me.hwnd, "Open", PartOfString(SearchEngineList, "|", WithWhat) & ForWhat & PartOfString(SearchEngineList, "|", WithWhat + 1), "", App.Path, 1)
End Sub

Author: dwirch

Derek Wirch is a seasoned IT professional with an impressive career dating back to 1986. He brings a wealth of knowledge and hands-on experience that is invaluable to those embarking on their journey in the tech industry.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.