The online function always return true though i am working in offline. Please tell me what is problem. I aam connected to Internet by LAN.

Quote Originally Posted by kochhar
I've been using the following function with success. It returns
TRUE if a connection is available, and takes less than
a sec in either case:

Code:
BOOL Online()
{
    DWORD dwState = 0; 
    DWORD dwSize = sizeof(DWORD);
	 return InternetQueryOption(NULL,
		 INTERNET_OPTION_CONNECTED_STATE, &dwState, &dwSize)
		 && (dwState & INTERNET_STATE_CONNECTED);
}
Credit: I got this from Paul Dilascia's column in MSDN mag a while
back.