|Adding an email link to your program|
|By: Lorenzo Dalla Vecchia Date: 16/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:
X = ShellExecute(hwnd, "Open", "mailto:" & EMailAddress, &O0, &O0, SW_NORMAL)
Replacing EMailAddress with the email address of the person to write to (i.e. "email@example.com").
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
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!).
|Visual Basic Programming Zone is a website by
Lorenzo Dalla Vecchia.
Webmaster's e-mail: firstname.lastname@example.org
Hosted by InWind: www.inwind.it