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
Solved

Simple Shell??? Question

Posted on 1998-09-27
2
195 Views
Last Modified: 2010-04-30
Hi!

I have a VERY simple question.
I have VB5

I want my program to open up the user's browser, and bring up a homepage.

Thing is, A. We don't know where the browser is, and B. Netscape or INternet Explorer?

I tried a couple of things:
x% = shell("http://whatever.com", Vbwhatever)
will bring up: filenotfound

x% = shell("c:\windows\explorer http://whatever.com", vbwhatever)
This will work, as long as you have IE 4...
I want it to work nomatter what

Please help :)
0
Comment
Question by:eversoslightly
2 Comments
 
LVL 1

Accepted Solution

by:
saam earned 10 total points
ID: 1436842
Option Explicit

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_SHOW = 5
-------------------------------------------------------------------------------------------------------------------------------

'This will open the url: http://whatever in the system's default browser when the user clicks 'the button named Command1.
Private Sub Command1_Click()
    ShellExecute hwnd, "open", "http://whatever", vbNullString, vbNullString, SW_SHOW
End Sub

/saam
0
 
LVL 1

Author Comment

by:eversoslightly
ID: 1436843
Thanks!

Works great.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
Introduction While answering a recent question (http://www.experts-exchange.com/Q_27402310.html) in the VB classic zone, I wrote some VB code in the (Office) VBA environment, rather than fire up my older PC.  I didn't post completely correct code o…
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…
This lesson covers basic error handling code in Microsoft Excel using VBA. This is the first lesson in a 3-part series that uses code to loop through an Excel spreadsheet in VBA and then fix errors, taking advantage of error handling code. This l…

861 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