Option Explicit
'Function needed to launch the browser 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 'Window constants for the API Const SW_SHOWMAXIMIZED = 3 Const SW_SHOWMINIMIZED = 2 Const SW_SHOWNORMAL = 1 'Local variables Private mstrURL As String Private mlngMax As Long Private mlngMin As Long Private mlngNormal As Long Property Let URL(strURL As String) mstrURL = strURL End Property Property Let Maximized(bMax As Boolean) If bMax Then mlngMax = SW_SHOWMAXIMIZED End If End Property Property Let Minimized(bMin As Boolean) If bMin Then mlngMin = SW_SHOWMINIMIZED End If End Property Property Let Normal(bNormal As Boolean) If bNormal Then mlngNormal = SW_SHOWNORMAL End If End Property Public Sub OpenURL() Call ShellExecute(0&, vbNullString, mstrURL, _ vbNullString, "C:\", mlngMax Or mlngMin Or mlngNormal) End Sub Public Sub Mail() Call ShellExecute(0&, vbNullString, "mailto:" & mstrURL, _ vbNullString, "C:\", mlngMax Or mlngMin Or mlngNormal) End Sub 'The class is used to launch the browser 'with the parameters - URL/mailto, Maximized or 'Minimized, or Normal; 'Example : 'Private Sub cmdLaunch_Click() ' Dim Hlink As New clsHlink ' Hlink.URL = "http://www.someurl.com" ' 'write the email address if you want to send an email ' Hlink.Maximized = True ' Hlink.OpenURL 'End Sub |