인터넷에 연결 되어있는지 확인하는 API



InetIsOffline


BOOL InetIsOffline(
  DWORD dwFlags
);


Returns TRUE if the local system is not currently connected to the Internet. Returns FALSE if the local system is connected to the Internet or if no attempt has yet been made to connect to the Internet.

=================================================================================================



int InternetGetConnectedState()

{
DWORD dwConnectionTypes;
if(InternetGetConnectedState(&dwConnectionTypes, 0)) // 정상적으로 검사됨
{
   
if((dwConnectionTypes & INTERNET_CONNECTION_MODEM) != 0)
ShowMessage(
"Modem으로 인터넷 사용중...");
   
if((dwConnectionTypes & INTERNET_CONNECTION_LAN) != 0)
ShowMessage(
"LAN으로 인터넷 사용중...");
   
if((dwConnectionTypes & INTERNET_CONNECTION_PROXY) != 0)
ShowMessage(
"Proxy로 인터넷 사용중...");
   
if((dwConnectionTypes & INTERNET_CONNECTION_MODEM_BUSY) != 0)
ShowMessage(
"Modem을 다른 용도로 사용중");
   
if((dwConnectionTypes & INTERNET_RAS_INSTALLED) != 0)
ShowMessage(
"RAS가 설치되어 있음");
   
if((dwConnectionTypes & INTERNET_CONNECTION_OFFLINE) != 0)
ShowMessage(
"오프라인");
   
if((dwConnectionTypes & INTERNET_CONNECTION_CONFIGURED) != 0)
ShowMessage(
"인터넷 연결이 설정되었음");
}
else
   ShowMessage("검사할 수 없습니다");

return 0;

}