Hi everyone

Does InternetGetConnectedState work in win98?
My win98 PC returns a "connected" value when it is not connected to the Internet or network.

Posted on 2004-07-29 01:38:02 by trexxz
It works correctly with my programs. Better try using InternetGetConnectedStateEx. And tell us what lpdwFlags are you setting - you may have set them wrong, who knows...

Posted on 2004-07-29 03:55:48 by siddhartha
I have to declare INTERNET_CONNECTION_OFFLINE as it is not in windows.inc

My code goes like this.




local status :DWORD

invoke InternetGetConnectedState,addr status,NULL
.if eax
mov eax,status
"Display Connection by Modem Message"

mov eax,status
"Display Connection by LAN Message"


mov eax,status
"Display Offline Message"

Posted on 2004-07-29 21:48:33 by trexxz
Perhaps its related to this (found in a search on the web):

Win95 and IE4+?

We can use WinInet and InternetGetConnectedState but if the user runs another browser (like Netscape)
and doesn't have IE configured then InternetGetConnectedState may give us false information.

For example, I used to have IE installed on both WinNT4 and Win98 systems (with a LAN between them)
but I used NetScape with a modem on each machine to connect to the Internet (I now use Mozilla and DSL).
With Internet Explorer configured to use a LAN connection, InternetGetConnectedState always returns TRUE.
When I checked both of my systems they were both configured by default to "use a LAN connection" since I
never configured IE. On both systems I got TRUE from InternetGetConnectedState when I was not online.

Microsoft http://support.microsoft.com/default.aspx?scid=kb;en-us;242558 says: "You can be assured
however that if InternetGetConnectedState returns TRUE, that attempting your connection will NOT cause
you to be prompted to connect to the default Internet Service Provider." That statement was false on my
systems where I used NetScape. On my systems InternetGetConnectedState always returned TRUE, and
if I trusted that information and attempted a connection to some place on the Internet I got the default
dialup networking prompt.
Posted on 2004-07-29 23:27:28 by Graebel
That means using InternetGetConnectedState is not a good way to check for internet connection? What about InternetGetConnectedStateEx? Are there any other better ways?
Posted on 2004-07-30 23:32:16 by trexxz
Take a look at this prog from Iczy's site


You could put the loop in another thread in your prog, or you can do it in the message lop of your prog

Hope its useful!:alright:

Thomas Antony:alright:
Posted on 2004-07-31 09:31:00 by thomasantony
Thanks thomasantony.

I'm looking for a way which does not trigger off firewall alerts. E.G. zonealarm. Therefore, i do not want to try to connect to a host or url.

So far, i only know about InternetGetConnectedState.

Posted on 2004-08-01 21:46:14 by trexxz
InternetGetConnectedState will completely fail you if someone is using NAT.
Posted on 2004-08-02 07:19:13 by The Beginner
The Beginner

Do you mean Network Address Translation?
Posted on 2004-08-02 21:39:59 by trexxz

For instance...

Someone is hooked up to the internet via a router on their LAN. InternetGetConnectedState() will ALWAYS see the internet as "active" because the router is usually active handling the LAN as well as the internet connection.

That is why pinging is the better option. If you want to skirt around a firewall (for whatever your reasons may be), you can hook into an application that can access the 'net and check the connection through that.
Posted on 2004-08-04 18:58:18 by The Beginner