473,385 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Problem checking for internet connection

This check seems to be 'true' even when I'm not connected to the internet.
My network card is disabled also. Could someone tell me what I'm doing
wrong?

--
Declare Function InternetCheckConnection Lib "wininet.dll" Alias
"InternetCheckConnectionA" (ByVal lpszUrl As String, ByVal dwFlags As Long,
ByVal dwReserved As Long) As Long

Private Sub btn_chk_int_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles btn_chk_int.Click

Const FLAG_ICC_FORCE_CONNECTION = False

If InternetCheckConnection("http://www.yahoo.com",
FLAG_ICC_FORCE_CONNECTION, 0&) = 0 Then

MsgBox("Connection to http://www.yahoo.com ---failed---!",
vbInformation)

Else

MsgBox("Connection to http://www.yahoo.com succeeded!",
vbInformation)

End If

End Sub

--
Nov 28 '05 #1
2 3102
"Flashster" <fl***********@hotmail.com> schrieb:
This check seems to be 'true' even when I'm not connected to the internet.
My network card is disabled also. Could someone tell me what I'm doing
wrong?

--
Declare Function InternetCheckConnection Lib "wininet.dll" Alias
"InternetCheckConnectionA" (ByVal lpszUrl As String, ByVal dwFlags As
Long, ByVal dwReserved As Long) As Long


Your declaration is wrong. Use this one instead:

\\\
Private Declare Auto Function InternetCheckConnection Lib "wininet.dll" ( _
ByVal lpszUrl As String, _
ByVal dwFlags As Int32, _
ByVal dwReserved As Int32 _
) As Boolean

Private Const FLAG_ICC_FORCE_CONNECTION As Int32 = &H1
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 28 '05 #2
Thanks
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eR**************@TK2MSFTNGP15.phx.gbl...
"Flashster" <fl***********@hotmail.com> schrieb:
This check seems to be 'true' even when I'm not connected to the
internet. My network card is disabled also. Could someone tell me what
I'm doing wrong?

--
Declare Function InternetCheckConnection Lib "wininet.dll" Alias
"InternetCheckConnectionA" (ByVal lpszUrl As String, ByVal dwFlags As
Long, ByVal dwReserved As Long) As Long


Your declaration is wrong. Use this one instead:

\\\
Private Declare Auto Function InternetCheckConnection Lib "wininet.dll"
( _
ByVal lpszUrl As String, _
ByVal dwFlags As Int32, _
ByVal dwReserved As Int32 _
) As Boolean

Private Const FLAG_ICC_FORCE_CONNECTION As Int32 = &H1
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Nov 28 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: NohaKhalifa | last post by:
Dear All; I'm developing a web site and i need to make adminisration for this site it's a site for Real Estates . But I don't need the administration to be online .. I want them to fill data...
4
by: Tat | last post by:
Hello, I have a weird show stopper here. I created a Windows application (.NET 1.1). My dev. machine is not hooked up to the Internet, neither it has firewall. I installed the app on a...
0
by: Stephen | last post by:
I am developing a VB .Net application that accesses a web service to upload information to the company. This is all working but I have now been asked to get the program to make a connection to the...
2
by: Roland | last post by:
I am having trouble installing dotnetfx on a machine. Here is the dotnetfx.log file Any Ideas how to fix the machine so it will install will be helpful. What does ReturnCode=995 mean? I...
2
by: feman | last post by:
I'm trying to install the dotnet framework 1.1 on a Windows 2000 Pro, SP 4 box. I've downloaded dotnetfx.exe and am installing from c:\temp. This is the error message that I get: Error 1606....
8
by: Nikola Bucic | last post by:
Could someone tell me how can I constantly check if I'm connected to internet and if possible to determine what type of connection is it. My best shot wright now is to have a timer which will...
1
by: den 2005 | last post by:
Hi everybody, How do you monitor the connection if it is still open or close for a dial up and internet RAS connection? I used both dialup and vpn RAS. The dialup is for modem connection and vpn...
4
by: Goldwind | last post by:
Hi, From a desktop application, i want to check if an internet connection exist. Many articles use the win api "InternetGetConnectedState", but it is no sure thing. I can check it by calling a...
16
by: lawrence k | last post by:
I've made it habit to check all returns in my code, and usually, on most projects, I'll have an error function that reports error messages to some central location. I recently worked on a project...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.