views:

531

answers:

2

I want to use the wininet function InternetCheckConnection to check whenever the machine is connected to the internet and can access a specific host. The problem is that this function is always returning false, no matter the URL I put on it.

MSDN link

A: 

Just a wild guess, but perhaps this is due to a personal firewall blocking all outgoing connections for one of the Windows DLLs and / or your application?

Adrian Grigore
I don't have a firewall configured on my machine. All protocols and ports can be accessed freely. :)
gmuller
Well, as I said, it was just a wild guess :-)
Adrian Grigore
A: 

Have you checked GetLastError() ? If I read MSDN correctly, you would need to check for ERROR_NOT_CONNECTED to determine whether you're truly offline.

MSalters