Home
Tutorials
Code Snippets
Code Samples
Downloads
Links

The Blog
Our Projects
About
Contact

::Add RageStorm to Favorites!::

The Blog | Our Projects | Guest Book | About | Contact

 
Code Snippet - Connected to Inet
Author:WebMaster
Category:Internet & Networks
File Size:667 Bytes
Uploaded at:04-May-03 10:10:52 am
Description:
  Checks whether local computer is connected to the Internet.
  
Checking if the user is connected to the Internet.

#include <ras.h>
bool IsConnected()
{
   RASCONN TRasCon;
   RASCONNSTATUS Tstatus;

   DWORD lg;
   DWORD lpcon;
   bool lReturn;

   TRasCon.dwSize = 412;
   lg = 256 * TRasCon.dwSize;
   lReturn = false;

   if (RasEnumConnections(&TRasCon, &lg, &lpcon) == 0)
   {
    Tstatus.dwSize = 160;
    RasGetConnectStatus(TRasCon.hrasconn, &Tstatus);
    lReturn = (Tstatus.rasconnstate == 0x2000);
   }
   return(lReturn);
}

 if(IsConnected()) // It's OK.... Connected.. :-)
 else // Not Connected.. :-(


Another way is to use:
#include <intshcut.h>
bool connected = !InetIsOffline(0);
User Contributed Comments(None)
NOTE:
Comments that will hurt anyone in any way will be deleted.
Don't ask for features, advertise or curse.
If you want to leave a message to the author use the contacts,
if you have any question in relation to your comments please use the forum.
Comments which violate any of these requests will be deleted without further
notice. Use the comment system decently.

Post your comment:
Name:
email:
Comment:
::Top 5 Tutorials::
Embedded Python[116829]
2D Rotated Rectangles Collision Detection[88945]
Keyboard Hook[77237]
UDP[65795]
HTTP Proxy[41184]

::Top 5 Samples::
2D ColDet Rotated Rectangles[11557]
PS2 Mouse Driver[6953]
Wave Format Player[5788]
Reading FAT12[5615]
CodeGuru[5355]


All rights reserved to RageStorm © 2009