VB按按钮就打开网站的代码是多少?
发布网友
发布时间:2024-10-05 14:06
我来回答
共4个回答
热心网友
时间:2024-10-05 14:40
1.基于start.exe
+++++++++++++++++++源码1++++++++++++++++++++++
url="http://hi.baidu.com/tanry"
shell "start " & url,0
+++++++++++++++++++源码2++++++++++++++++++++++
url="http://hi.baidu.com/tanry"
shell "cmd.exe /c start " & url,0
2.基于文件浏览器(explorer.exe)
+++++++++++++++++++源码+++++++++++++++++++++++
url = "http://hi.baidu.com/tanry"
Shell "explorer " & url, 0
3.基于IE浏览器的
+++++++++++++++++++源码1(使用IE对象)++++++++++
Dim Browser As Object
url="http://hi.baidu.com/tanry"
Set Browser = CreateObject("InternetExplorer.Application")
Browser.Visible = True
Browser.Navigate (url)
+++++++++++++++++++源码2++++++++++++++++++++++
Private Sub cmd1_Click()
url = "http://hi.baidu.com/tanry"
exe = Environ("programfiles") & "\Internet Explorer\IEXPLORE.EXE"
Shell exe & Space(1) & url, 1
End Sub
5.基于API的
'API函数声明 :
+++++++++++++++++++源码++++++++++++++++++++++
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 Const SW_SHOWNORMAL = 1
'函数返回值为大于32的整数表明成功执行调用,小于或等于32表明调用失'败。
'例如:
Dim Result
Result = ShellExecute(0, vbNullString, "http://hi.baidu.com/tanry", vbNullString, vbNullString, SW_SHOWNORMAL)
If Result <= 32 Then
MsgBox "调用浏览器错误!", vbOKOnly + vbCritical, "错误:", 0
End If
6.基于WebBrowser控件的
+++++++++++++++++++源码++++++++++++++++++++++
url="http://www.baidu.com"
WebBrowser1.Navigate url
热心网友
时间:2024-10-05 14:41
ShellExecute(handle, ‘open’, http://www.baidu.com, nil, nil, SW_SHOWNORMAL);
热心网友
时间:2024-10-05 14:41
这是键盘跳线了或者是进水了,需要键盘的维修~!
热心网友
时间:2024-10-05 14:42
能打开啊