CodeItBetter Programming Another VB Programming Blog

How to create a email link in your form

Posted on January 4, 2009
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
'Controls - How to create a email link in your form
'Create a Label (Label1), set its Caption to an e-mail address, and add the following code:

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 Form_Load()
    Label1.AutoSize = True
End Sub
 
Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Label1.ForeColor = vbButtonText
    Label1.Font.Underline = False
End Sub
 
Private Sub Label1_Click()
    Call ShellExecute(0, vbNullString, "mailto:" & Label1.Caption, vbNullString, _
        vbNullString, vbNormalFocus)
End Sub
 
Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Label1.ForeColor = vbBlue
    Label1.Font.Underline = True
End Sub

Related posts:

  1. How to Send Email to an Address in a Label (Text Box).
  2. How to Move image with the mouse in a form
  3. How to Draw Rainbow Text in Picture Box
  4. How to create a popup menu
  5. How to create a screen saver.
  6. How to move a Form without Title bar
  7. How to create Controls in a form runtime (without creating in design time)
  8. How to check on which word the Mouse hover in Rich Text Box
  9. How to calculate arctangents in all four quadrants
  10. How to make text on a form scroll upward.

Filed under: Controls Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.