Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

how do i find default web browser?

Posted on 2002-06-05
9
Medium Priority
?
162 Views
Last Modified: 2010-05-02
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?
0
Comment
Question by:BobDole
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 3
  • 2
9 Comments
 
LVL 1

Accepted Solution

by:
Toad224 earned 800 total points
ID: 7057023
You don't need to find out what the default browser is if you just want to open your site.  You should use the WinAPI ShellExecute(), and that will open the default browser automatically.

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 Sub Command1_Click()
ShellExecute 0, vbNullString, "http://experts-exchange.com", vbNullString, vbNullString, 1
End Sub

I hope that helps.  Good luck!
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7057040
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
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7057042
damn, too slow ;)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 

Author Comment

by:BobDole
ID: 7057068
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?
0
 
LVL 1

Expert Comment

by:Toad224
ID: 7057072
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!
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7057076
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
0
 
LVL 18

Expert Comment

by:bobbit31
ID: 7057079
damn, too slow again!
0
 
LVL 1

Expert Comment

by:Toad224
ID: 7057101
lol
0
 

Author Comment

by:BobDole
ID: 7057112
oh ****   that works   sweet!

thx guys
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
This article describes some techniques which will make your VBA or Visual Basic Classic code easier to understand and maintain, whether by you, your replacement, or another Experts-Exchange expert.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses

636 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question