CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 5 of 5

Thread: Start / Run...

  1. #1
    Join Date
    Dec 1999
    Posts
    18

    Start / Run...

    Hello,

    Using Win95/Win98, if you were to click on Start / Run..., and then type "http://www.microsoft.com" for example, Windows would launch your default browser and open up Microsoft's page.

    Other than generating Mouse Moves and Mouse clicks, how would one programatically re-create the same behaviour using VB ? In other words, what's the easiest way to start up your browser with a given web address using VB ?


  2. #2
    Join Date
    Sep 1999
    Location
    Red Wing, MN USA
    Posts
    312

    Re: Start / Run...

    Use the ShellExecute API, ie.
    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&, "OPEN", "http://www.godeguru.com", "", "", 1
    End Sub



    Aaron Young
    Analyst Programmer
    [email protected]
    [email protected]
    Aaron Young
    Senior Programmer Analyst (Red Wing Software)
    Certified AllExperts Expert

  3. #3
    Join Date
    Jan 2000
    Posts
    45

    Re: Start / Run...

    'ok this will work for sure....
    'put this in the forms declarations:
    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
    'This is the code so when they click the label it will launch the browser and 'the address you specified
    private Sub Label1_Click()
    Call ShellExecute(0&, "OPEN", "http://www.doodie.com", "", "", 1)
    End Sub





Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured