Results 1 to 6 of 6

Thread: [RESOLVED] How to open website

  1. #1

    Thread Starter
    New Member
    Join Date
    Mar 2009
    Posts
    5

    Resolved [RESOLVED] How to open website

    Hallo to all, I would like to ask a simple code on how to open a website using a specific IP Address like 125.168.0.1 will open the "http://www.google.com" using VB 6, thank you so much.

  2. #2
    I'm about to be a PowerPoster! Hack's Avatar
    Join Date
    Aug 2001
    Location
    Searching for mendhak
    Posts
    58,333

    Re: How to open website

    vb Code:
    1. Option Explicit
    2.  
    3. Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
    4. (ByVal  hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _
    5. ByVal lpParameters As String, ByVal lpDirectory As String, _
    6. ByVal nShowCmd As Long)  As Long
    7.  
    8. Private Sub Command1_Click()
    9.    Dim lngOpenPage As Long
    10.      lngOpenPage = ShellExecute(Form1.hwnd, "Open", "125.168.0.1",  0&, 0&, 0&)
    11. End Sub

  3. #3
    Junior Member
    Join Date
    Mar 2004
    Location
    East Durham, New York
    Posts
    22

    Re: How to open website

    UPDATED GOOGLE IP

    Just put one command button on form and name it command1, copy,past this code in, run program. tested good


    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 Sub Command1_Click()
    Dim lngOpenPage As Long
    lngOpenPage = ShellExecute(Form1.hwnd, "Open", "http:\\74.125.53.100", 0&, 0&, 0&)
    End Sub

  4. #4

    Thread Starter
    New Member
    Join Date
    Mar 2009
    Posts
    5

    Re: How to open website

    Thank you so much. . .I would like to ask what is ( 0&, 0&, 0& ) and (Form1.hwnd) means?

  5. #5
    Super Moderator si_the_geek's Avatar
    Join Date
    Jul 2002
    Location
    Bristol, UK
    Posts
    41,974

    Re: How to open website

    0& means 0, the & just forces it to be a particular data type. If you want more information, see the article about it in the "Language Syntax" section of our Classic VB FAQs

    hWnd is a unique reference to a window (in this case your form) that Windows assigns. It does that for every window on the screen (including lots that you wouldn't think are windows) so that it can interact with them as needed.

  6. #6

    Thread Starter
    New Member
    Join Date
    Mar 2009
    Posts
    5

    Re: How to open website

    Now I understand, the code you gave me worked well. I got 2 IP Address 192.168.1.1 which I am using now and 192.168.0.1 as my backup IP Address. I want to open the "www.yahoo.com" using my backup IP Address which is 192.168.0.1 without changing my TCPIP which is 192.168.1.1. How to do that? Please help me, this is a big thesis defense. Thank you soooooo much. . .

Tags for this Thread

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