Visual Basic Programming Code Examples
Visual Basic > Internet Web Mail Stuff Code Examples
Another way to start an URL in VB
Another way to start an URL in VB
'start htlm page from VB5
'on the General Declaretions section
'I'd just like to suggest that you pass the VB5.0 predefined constant vbNullString in the ShellExecute
'function in your VB5.0 Shell and URL examples, instead of the empty VB string "". Since API's are written
'in c, they are expecting a null-terminated string, otherwise strange things might occur.
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 Declare Function GetDesktopWindow Lib "user32" () As Long
Const SW_SHOWNORMAL = 1
Public Function StartURL(URL As String) As Long
dim Scr_hDC As Long
Scr_hDC = GetDesktopWindow()
StartURL = ShellExecute(Scr_hDC, "Open", URL, vbNullString, "C:\", SW_SHOWNORMAL)
End Function
'use as Call StartDoc("http://www.microsoft.com")
Return