|
-
Jun 30th, 2000, 02:56 PM
#1
Thread Starter
Member
How Can I Create A link on A Form That When Clicked On Will Open A Web Browser And Take The User To My Web Site
My Web Site URL Is:
http://www.angelfire.com/fl3/crazymarc
I Think I Might Dont Know The Answer To That One...
-
Jun 30th, 2000, 03:14 PM
#2
Code:
Public Enum OpType
Startup = 1
Click = 2
FormMove = 3
LinkMove = 4
End Enum
Dim Clicked As Boolean
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
Public Sub MakeLink(LabelName As Label, Operation As OpType, Optional FormName As Form)
Dim Openpage As Integer
Select Case Operation
Case LinkMove
LabelName.ForeColor = 255
LabelName.FontUnderline = True
Case Click
Openpage = ShellExecute(FormName.hwnd, "Open", LabelName.Caption, "", App.Path, 1)
LabelName.ForeColor = 8388736
Clicked = True
Case FormMove
LabelName.FontUnderline = False
If Not Clicked Then
LabelName.ForeColor = 16711680
Else
LabelName.ForeColor = 8388736
End If
Case Startup
LabelName.ForeColor = 16711680
End Select
End Sub
Or just set the label to look like a blue color.
Code:
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
Label_Click:
ShellExecute Me.hwnd, vbNullString, "http://www.site.com", vbNullString, "c:\", SW_SHOWNORMAL)
[Edited by Matthew Gates on 07-01-2000 at 04:18 AM]
-
Jun 30th, 2000, 03:21 PM
#3
Addicted Member
Module Code: Create a Bas Module and enter the following
Code:
Option Explicit
Public Const URL = "http://angelfire.com/fl3/crazymarc"
Public Const email = "crazymarc@someplace"
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
Form Level Code: The Form needs two labels; lblEmail and
lblURL
Code:
Private Sub Form_Load()
lblEmail = email
lblURL = URL
Me.Move (Screen.Width - Me.Width) / 2, (Screen.Height - Me.Height) / 2
End Sub
Private Sub lblEmail_Click()
sendemail
End Sub
Private Sub lblURL_Click()
gotoweb
End Sub
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|