CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  VB >  基础类

VB中使用超链接?

楼主polarwyp(☆Polaris☆)2003-12-01 15:53:29 在 VB / 基础类 提问

单击一个Label,自动打开某个网址。如何实现?越简单越好  
  谢谢 问题点数:30、回复次数:4Top

1 楼yoki(小马哥--鬓微霜,又何妨)回复于 2003-12-01 15:57:33 得分 10

Public   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  
   
  Call   ShellExecute(frmHrp.hwnd,   "open",   label1.caption   ,vbNullString,   vbNullString,   &H5)Top

2 楼nik_Amis(...)回复于 2003-12-01 16:04:59 得分 10

楼上的方法有个毛病  
   
  会打开已经有的IE,非常不有好,这个不会,呵呵  
   
  Public   Sub   OpenSite(ByVal   sURL   As   String)  
          Dim   oIE   As   Object  
          Set   oIE   =   CreateObject("InternetExplorer.Application")  
          oIE.Navigate   sURL  
          oIE.Visible   =   True  
          Set   oIE   =   Nothing  
  End   Sub  
  Top

3 楼SoHo_Andy(冰)回复于 2003-12-01 16:05:36 得分 5

Public   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  
   
  举例说明,label2为控件数组  
  Private   Sub   Label2_Click(Index   As   Integer)  
          On   Error   GoTo   ErrTrap  
            Select   Case   Label2(Index).Caption  
                  Case   "微软网站"  
                            ShellExecute   hwnd,   "Open",   "http://www.MicroSoft.com",   0,   0,   0  
                  Case   "程序员"  
                            ShellExecute   hwnd,   "Open",   "http://www.csdn.net",   0,   0,   0  
          End   Select  
          On   Error   GoTo   0  
          Exit   Sub  
  ErrTrap:  
          On   Error   GoTo   0  
  End   Sub  
  Top

4 楼thl0352(红儿)回复于 2003-12-01 16:06:53 得分 5

同意楼上!  
  Option   Explicit  
   
  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()  
  Call   ShellExecute(Form1.hwnd,   "open",   Label1.Caption,   vbNullString,   vbNullString,   1)  
  End   Sub  
  Top

相关问题

  • VB中的超链接
  • 在VC++中怎么使用VB编写的COM链接库?
  • vb 使用 RegisterServiceProcess
  • vb中使用winsock时如何使用超时。
  • word中不能使用超链接
  • VB 中使用TAPI
  • vb中如何做一个象网页中的mail超链接?
  • vb中怎么样超级链接到一个主页上
  • 如何在VB中实现超级链接形式的label?
  • VB中如何使用SetBitmapDimensionEx?

关键词

  • shell
  • dll
  • oie
  • byval
  • shellexecute
  • shellexecutea
  • lpoperation
  • vbnullstring
  • lpdirectory
  • nshowcmd

得分解答快速导航

  • 帖主:polarwyp
  • yoki
  • nik_Amis
  • SoHo_Andy
  • thl0352

相关链接

  • Visual Basic类图书
  • Visual Basic类源码下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo