Tuesday, June 28, 2005

To add Hyperlink in VB6.0

Check out the code to get hyperlink features in Visual Basic

'To make this hyperlink look really professional
'Place the lblURL into a frame
'Re-size the frame so that it is exactly the SAME size
'as lblURL. Then in design time, change the mouse pointer
'for the form to 3 I-Beam. And change the MousePointer
'for the frame to 1 Arrow.
'As stated on the previous article if linking to e-mail
'then uncomment line containing mail and comment
'line below


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()
With lblurl
.ForeColor = vbBlue
.Font.Underline = True
End With

End Sub

Private Sub lblurl_Click()
With lblurl
' Call ShellExecute(0&, vbNullString, "Mailto:" & .Caption, vbNullString, vbNullString, vbNormalFocus)
Call ShellExecute(0&, vbNullString, .Caption, vbNullString, vbNullString, vbNormalFocus)
End With
End Sub


Comments Pls
Credits: Shreejith G

0 Comments:

Post a Comment

<< Home