欢迎光临

木子屋

标题: 在VB中实现链接的方法

作者: admin

日期: 2006-06-27 05:00 PM

分类: Win编程

内容: 一、运行服务器网页
新建立一个模块
然后再其中添加如下代码 ：
Option Explicit
Public Const email = "support@online.com"
Public Const URL = "http://blog.csdn.net/flm2003/"
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
Public Const SW_SHOWNORMAL = 1
Public Sub gotoweb()
Dim Success As Long
Success = ShellExecute(0&, vbNullString, URL, vbNullString, "C:\", SW_SHOWNORMAL)
End Sub
Public Sub sendemail()
Dim Success As Long
Success = ShellExecute(0&, vbNullString, "mailto:" & email, vbNullString, "C:\", SW_SHOWNORMAL)
End Sub
接着就简单不过了！
在你所要进行超连接的窗体中，如实现LABEL的超连接
那就在LABEL的CLICK事件中加入 gotoweb或sendemail 即可！
二、运行本地文件
1.利用ShellExecute
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
ShellExecute hwnd, "open", App.Path & "\index.htm", vbNullString, vbNullString, 1
2.利用Shell
Shell "explorer.exe " & App.Path & "\index.htm", 1

+ 查看当前日志评论 (1)

登录

────────────

木子屋

PJBlog3 v3.2.9.518 Inside.

Processed In 1.039 ms

返回

标题: 在VB中实现链接的方法

你没有权限发表评论

────────────

木子屋

PJBlog3 v3.2.9.518 Inside.

Processed In 1.039 ms

返回

暂无评论

返回

────────────

木子屋

PJBlog3 v3.2.9.518 Inside.

Processed In 1.086 ms

返回