Link to home
Start Free TrialLog in
Avatar of BobDole
BobDole

asked on

how do i find default web browser?

i want to make a vb program so that when i click a button, it opens up the default web browser and goes to the URL of my site.  is this possible with vb?
ASKER CERTIFIED SOLUTION
Avatar of Toad224
Toad224
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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 Const SW_SHOWNORMAL = 1

Private Sub Command1_Click()
ShellExecute Me.hwnd, "open", "http://www.google.com", vbNullString, vbNullString, SW_SHOWNORMAL
End Sub
damn, too slow ;)
Avatar of BobDole
BobDole

ASKER

neither of those work

i get some error   only comments may appear after end sub, end function, or end property

does anyone have code that works for vb6?
You need to put the

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

part at the top of the code in the form, or put

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

at the top of your module.



Good luck!
this is vb:

put this at the top of your form code:
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 Const SW_SHOWNORMAL = 1


then put this:
Private Sub Command1_Click()
ShellExecute Me.hwnd, "open", "http://www.google.com", vbNullString, vbNullString, SW_SHOWNORMAL
End Sub
damn, too slow again!
lol
Avatar of BobDole

ASKER

oh ****   that works   sweet!

thx guys