Results 1 to 8 of 8

Thread: [Resolved]

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2004
    Location
    Canada
    Posts
    2

    Resolved [Resolved]

    Is it possible to code through VB that you click on something (such as a label) and it opens your internet browser (i.e. IE - lol ) and goes to a specific website? I glanced through the forum but only saw stuff about brining windows to the front that are already open, not what I'm looking for, but maybe I'm just blind .

    Thanks folks.
    Last edited by ZaP1989; Nov 8th, 2004 at 05:27 PM.

  2. #2
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    i believe that you can use SHELL "url" or SHELL "http\\:url" to open the link with the default browser.
    Last edited by dglienna; Nov 8th, 2004 at 05:11 PM.

  3. #3
    Fanatic Member laserman's Avatar
    Join Date
    Jan 2002
    Location
    Wales U.K
    Posts
    775
    Is this what you want?

    VB Code:
    1. 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
    2. Const SW_SHOWNORMAL = 1
    3. Private Sub Label1_Click()
    4. ShellExecute Me.hwnd, vbNullString, "www.google.com", vbNullString, "C:\", SW_SHOWNORMAL
    5. End Sub

  4. #4

    Thread Starter
    New Member
    Join Date
    Nov 2004
    Location
    Canada
    Posts
    2
    thanks laserman, that worked.

  5. #5
    Fanatic Member laserman's Avatar
    Join Date
    Jan 2002
    Location
    Wales U.K
    Posts
    775
    Very welcome

  6. #6

  7. #7
    Software Eng. Megatron's Avatar
    Join Date
    Mar 1999
    Location
    Canada
    Posts
    11,286
    Another method is to use VB's Shell method, and pass the website as the command-line argument.

    I.e.
    Code:
    Shell "iexplore www.google.com", 1
    Note: This method assumes you want to specifically open it in Internet Explorer. To open with the default browser, stick with ShellExecute

  8. #8
    Banned dglienna's Avatar
    Join Date
    Jun 2004
    Location
    Center of it all
    Posts
    17,901
    just played with SHELL. You have to specify the pathname with the explorer. just the url doesn't open the browser, like I thought. shellexecute seems to be the best bet.
    sorry. should have tested it first.

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