Titre: Connexion à une page internet.
Description:
Avec le navigateur par défaut.
Le code:
Private Sub cmdGo_Click()
Dim sFileName As String
Dim sDummy As String
Dim sBrowserExec As String * 255
Dim lRetVal As Long
Dim iFileNumber As Integer
'Create a temporary HTM file
sBrowserExec = Space(255)
sFileName = "C:\TheScarms.HTM"
iFileNumber = FreeFile
Open sFileName For Output As #iFileNumber
Write #iFileNumber, "<HTML> <\HTML>"
Close #iFileNumber
' Find the default browser.
lRetVal = FindExecutable(sFileName, sDummy, sBrowserExec)
sBrowserExec = Trim$(sBrowserExec)
' If an application is found, launch it!
If lRetVal <= 32 Or IsEmpty(sBrowserExec) Then
MsgBox "Could not your Browser", vbExclamation, "Browser Not Found"
Else
lRetVal = ShellExecute(Me.hwnd, "open", sBrowserExec, "http://www.microsoft.com", sDummy, SW_SHOWNORMAL)
If lRetVal <= 32 Then
MsgBox "Web Page not Opened", vbExclamation, "URL Failed"
End If
End If
Kill sFileName
End Sub |