窥天地之奥 达造化之极
全部博文(105)
分类:
2006-06-13 12:38:44
1.开发步骤
首先运行VB6.0建立一个“标准EXE“的工程文件,根据如图所示添加一个文本框和一个标签框,根据自己对搜索引擎的喜好添加若干个Command按钮控件。
接着在代码编辑框的声明部份添加“ShellExecute”函数声明,然后再添加Command按钮代码,代码如下:
Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As _Long, ByVal lpOperation As String, ByVal lpFile As String, ByVallpParameters As String, ByVal _lpDirectory As String, ByVal nShowCmd As Long) As Long
Private Sub Command1_Click()
Dim url As String
'碰到错误后继续运行
On Error Resume Next
'提示在文本框中输入搜索关键字
If Text1.Text = "" Then
MsgBox "请先输入查找关键字!", , "错误!": Exit Sub
End If
'调用浏览器显示百度搜索的结果
ShellExecute hWnd, "open", "" + Text1.Text, "", "", 1
End Sub
//还可以扩充强大的搜索功能哟