Adding a web link to your program
By: Lorenzo Dalla Vecchia Date: 14/07/1998

If you want to add a web link (i.e. to your home page) in a program of yours, you have to call a API function.

First, add this declaration in the declarations section of a public standard module:

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_NORMAL = 1

Then, put this code where you want the link to pop-up:

Dim X
X = ShellExecute(hwnd, "Open",
URL, &O0, &O0, SW_NORMAL)

Replacing URL with the URL of the web page to show (i.e. "www.jump.to/vbprogzone").

You can put the above two instructions anywhere in your program. The best place is in the Click event of a Label formatted as a link (blu fore color and underline text).
You can put this instruction in the
MouseMove event of the Label...

labelname.ForeColor = vbRed

...and this in the MouseMove event of the form...

labelname.ForeColor = vbBlue

...(where labelname is the name of the link label), and the link will become red when you move the mouse on it (as in the browser!).

Click Here!


Visual Basic Programming Zone is a website by Lorenzo Dalla Vecchia.
Webmaster's e-mail: webmaster@vbprogzone.cjb.net
Hosted by InWind: www.inwind.it