Showing results for 
Show  only  | Search instead for 
Did you mean: 
Level 9

Check if Internet Connection Available

I am trying to check if PC could connect to Internet.

The check function Wininet.InternetCheckConnectionA does not come back.
What could be wrong?

Has anybody an idea how to test Internet Connection?


prototype BOOL Wininet.InternetCheckConnectionA(BYREF STRING, NUMBER, NUMBER);

UseDLL(WINSYSDIR ^ "\\Wininet.dll")

bInternetAvailable = Wininet.InternetCheckConnectionA("", FLAG_ICC_FORCE_CONNECTION, 0);
Labels (1)
0 Kudos
(4) Replies
Level 4

Did you get this to work? I am also looking for a good way to check if an internet connection exists. Thanks.
0 Kudos
Level 13

If you can use a CA, launch a command that executes the PING command.
Flexera's security rules for this site prevent me from posting an example. 😞
0 Kudos
Level 7

ping is not a good approach, because the firewall might be preventing pings.

ipconfig might be better and then you can check if the Ip address is valid.
0 Kudos
Level 5

ipconfig won't work. Most devices connect through a router so testing for network connectivity is not the same as checking for access to the internet. You need to make a call outside of the network and receive an expected response to determine access to the internet. Microsoft uses NCSI (Network Connectivity Status Indicator) There are 2 ways.

1) Have the installer download and check that you receive it. This is a plain text file containing the text "Microsoft NCSI"
2) Perform a DNS lookup on and verify the IP is If not, assume there is no internet access.
0 Kudos