Create TOC

2006년 3월 8일

인터넷 연결상태 알아오기


DWORD dwConnectionTypes;
if(InternetGetConnectedState(&dwConnectionTypes, 0)) // 정상적으로 검사됨
{
	if((dwConnectionTypes & INTERNET_CONNECTION_MODEM) != 0)
		printf("Internet connection using modem");

	if((dwConnectionTypes & INTERNET_CONNECTION_LAN) != 0)
		printf("Internet connection using LAN");

	if((dwConnectionTypes & INTERNET_CONNECTION_PROXY) != 0)
		printf("Internet connection using Proxy");

	if((dwConnectionTypes & INTERNET_CONNECTION_MODEM_BUSY) != 0)
		printf("Modem is busy");

	if((dwConnectionTypes & INTERNET_RAS_INSTALLED) != 0)
		printf("RAS is installed");

	if((dwConnectionTypes & INTERNET_CONNECTION_OFFLINE) != 0)
		printf("Offline");
}
else
	printf("InternetGetConnectedState() API is failed!");