关于打开网页的问题

bestchuan 2003-08-22 09:36:24
用VB建立了一个UserControl窗体,在上面添加了一按钮,如何在单击了这按钮后打开某网页?
我知道可以用
Shell ("C:\Program Files\Internet Explorer\iexplore.exe http:\\www.google.com"), vbNormalFocus
来打开,但怎样用当前正在显示的浏览器打开而不是新开一个窗口。
...全文
28 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
CrazyHosptial 2003-08-24
  • 打赏
  • 举报
回复
对不起,没有看清问题,如果是你说的,还是参看cuizm(射天狼) 的吧
小弟很菜....看的不是很懂...
CrazyHosptial 2003-08-24
  • 打赏
  • 举报
回复
不用啊,这样吧.
用Shell 函数

例子: 例如你想打开 网易163 吧.

Private Sub Command1_Click()

Shell "Explorer , http://www.163.com"

End Sub

我试过了~~~可以.
bestchuan 2003-08-23
  • 打赏
  • 举报
回复
还是不对啊,一运行就出现那句话,是不是要引用什么东西
射天狼 2003-08-23
  • 打赏
  • 举报
回复
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()
On Error GoTo Errhandle
'Shell "C:\Program Files\Internet Explorer\IEXPLORE.EXE mailto:cuizm@163.com", vbMinimizedFocus
ShellExecute Me.hwnd, "open", "http:\\www.google.com", vbNullString, vbNullString, 1
Exit Sub
Errhandle:
MsgBox Err.Description & "!", vbInformation
End Sub
bestchuan 2003-08-23
  • 打赏
  • 举报
回复
就是"compile error:Only comments only appear after end sub,end function,or end property"
junki 2003-08-23
  • 打赏
  • 举报
回复
是些 什么错误呢?
bestchuan 2003-08-23
  • 打赏
  • 举报
回复
程序一开始编译它就报错,还没点击按钮。
bestchuan 2003-08-23
  • 打赏
  • 举报
回复
是指那个(index as integer)吗,已经去掉了,还是不对。
射天狼 2003-08-23
  • 打赏
  • 举报
回复
把Label1_Click事件里的参数去掉,我用的是控件数组.
这些小错误你自己都调不了.
bestchuan 2003-08-23
  • 打赏
  • 举报
回复
编译的时候出错了,它指在上面那条FUNCTION上,说是"compile error:Only comments only appear after end sub,end function,or end property",这是什么原因?
射天狼 2003-08-23
  • 打赏
  • 举报
回复
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(Index As Integer)
On Error GoTo Errhandle
'Shell "C:\Program Files\Internet Explorer\IEXPLORE.EXE mailto:cuizm@163.com", vbMinimizedFocus
ShellExecute Me.hwnd, "open", "http:\\www.google.com", vbNullString, vbNullString, 1
Exit Sub
Errhandle:
MsgBox Err.Description & "!", vbInformation
End Sub
vansoft 2003-08-23
  • 打赏
  • 举报
回复
引用Microsoft Internet Explorer

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧