Welcome to collectivesolver - Programming & Software Q&A. A website you can trust. I check, compile and run every program. Contact me at: aviboots(AT)netvision.net.il
Hostgator 1 Penny

BlueHost Web Hosting

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

Ecommerce Software - Best Ecommerce Platform Made for You - Free Trial

getflywheel wordpress hosting


Distribute your Resume to 500+ Job Boards & Recruiters


6,846 questions

9,748 answers

573 users

How to check if a computer is connected to the internet in C Win32 API

1 Answer

0 votes
#include <stdio.h>
#include <windows.h>
#include <wininet.h> 

#if defined (_MSC_VER) 
	#pragma comment (lib, "wininet.lib") 
#endif 

int main(void)
{
	DWORD err;

	if (InternetCheckConnection(L"http:// www.collectivesolver.com", FLAG_ICC_FORCE_CONNECTION, 0))
	{
        printf("This computer connected to the internet\n");
	}
	else
	{
		err = GetLastError(); 
        if (err == ERROR_NOT_CONNECTED) 
            printf ("This computer NOT connected to the internet\n"); 
        else 
            printf ("err %d\n", err); 
	}
	
	return 0;
}



answered Feb 23, 2015 by avibootz
...