vb的问题。高手请进

来源:百度知道 编辑:UC知道 时间:2024/05/23 15:34:45
一个程序上有一个按钮。一按这个按钮就直接打开一个网站。请问这是怎么做的?我听过要用什么APT函数。。。呵呵。不太懂

最好能教我下仔细点。。。。
我就是想知道API怎么用的??怎么声明的。最好详细点。。可以加分
shell调用的我都会的。。

先添加声明(这是必要的,放在代码的最顶端)
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

public a%

然后
Private Sub Command1_Click()
a% = "http://www.baidu.com"
ret& = ShellExecute(Me.hwnd, "Open", a%, "", App.Path, 1)
End Sub

不用API,就用SHELL函数就可以了.

SHELL "IE路径 网页地址",1

就可以了.

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 Sub Label1_Click()
Dim fg As String
fg