How to Program command button to launch web browser

I am trying to setup a simple self executable that has a splash screen and then goes to a screen where you click on a command button and it lauches your internet browser and takes you to the specified web page I have visual basic version 5.0 learning edition and I see nothing in any of my books on how to do this I do not want anything except for a command button and a label on the form (no menu's etc...)
please help i need to create this a.s.a.p.
LVL 21
briancassinAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mark2150Commented:
In the buttons CLICK event you place your code to launch the browser. You can use SHELL to launch an application.

Private Sub Cmd_Click()
  Shell("IEXPLORE.EXE http://mysite.com"), 1
End Sub

This is close off the top of my head.

M
0
mcriderCommented:
Actually, you want to do:

Shell("start http://www.yourwebpage.com"),1

Don't call iexplorer directly, because it may not be in the search path, and IE may not even be installed on the computer...  May be Netscape...


Cheers!
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
VbmasterCommented:
Here's another method available, which will give you the error message if any..


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

Function Run(strFilePath As String, Optional strParms As String, Optional strDir As String) As String
       
  Const SW_SHOW = 5
 
  'Run the Program and Evaluate errors
  Select Case ShellExecute(0, "Open", strFilePath, strParms, strDir, SW_SHOW)
  Case 0
    Run = "Insufficent system memory or corrupt program file"
  Case 2
    Run = "File not found"
  Case 3
    Run = "Invalid path"
  Case 5
    Run = "Sharing or Protection Error"
  Case 6
    Run = "Seperate data segments are required for each task"
  Case 8
    Run = "Insufficient memory to run the program"
  Case 10
    Run = "Incorrect Windows version"
  Case 11
    Run = "Invalid program file"
  Case 12
    Run = "Program file requires a different operating system"
  Case 13
    Run = "Program requires MS-DOS 4.0"
  Case 14
    Run = "Unknown program file type"
  Case 15
    Run = "Windows program does not support protected memory mode"
  Case 16
    Run = "Invalid use of data segments when loading a second instance of a program"
  Case 19
    Run = "Attempt to run a compressed program file"
  Case 20
    Run = "Invalid dynamic link library"
  Case 21
    Run = "Program requires Windows 32-bit extensions"
  Case Else
    Run = ""
  End Select

End Function

0
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

briancassinAuthor Commented:
Is this the complete code for the button to access the website and it can be made a self executable correct so I can distribute onto diskettes ?

here is what you wrote I am assuming this is the complete code for the command button


Shell("start http://www.yourwebpage.com"),1


so here is hwo the completed code would look and this is all I need correct ?

Private Sub Cmd_Click()
  Shell("start http://www.yourwebpage.com"),1
End Sub



0
mark2150Commented:
Yep. It's that easy!

M
0
VbmasterCommented:
Actually it's ought to be

  Private Sub Cmd_Click()
    Call Shell("start http://www.yourwebpage.com", 1)
  End Sub
0
mcriderCommented:
Yes, That's it!


Cheers!
0
briancassinAuthor Commented:
It worked but now I am having a problem when I make it a self executable that the form is truncated but it looks fine on my system
0
mcriderCommented:
What do you mean by truncated?
0
briancassinAuthor Commented:
The actual form looks fine with my computer but when it is installed on others pc's the actual form size is smaller and the graphic is got part of it cut off..... almost like it got squashed but the text does not appear to be squashed the best way to describe it is that it is cut off
0
mcriderCommented:
Sounds like what you're dealing with now is a Screen Resolution/Font Size problem...

There are 2 windows setting (Large Font and Small Font) You can get to these settings by right-clicking on the desktop and selecting "Properties"... Then take a look at the "Settings" tab.

I would suggest testing your program with both fonts and different screen resolutions (the "Display Area" of the same settings tab.


Cheers!
0
VbmasterCommented:
Let's see.. can it be because the other pc's don't have the same screen resolution?
 
0
mcriderCommented:
Vbmaster,

That's the whole point of testing with different Screen Resolution/Font Sizes...

;-)
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.