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://www.ccw.com.cn", vbNullString, vbNullString, SW_SHOWNORMAL)
If Result <= 32 Then
MsgBox "调用浏览器失败!", vbOKOnly + vbCritical, "错误:", 0
End If
© 版权声明
文章版权归作者所有,未经允许请勿转载。