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.:wave:
Printable View
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.:wave:
vb Code:
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", "125.168.0.1", 0&, 0&, 0&) End Sub
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
Thank you so much. . .I would like to ask what is ( 0&, 0&, 0& ) and (Form1.hwnd) means?
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.
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. . .