Solved

Simple Shell??? Question

Posted on 1998-09-27
2
196 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Most everyone who has done any programming in VB6 knows that you can do something in code like Debug.Print MyVar and that when the program runs from the IDE, the value of MyVar will be displayed in the Immediate Window. Less well known is Debug.Asse…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
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…
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…

679 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