il faut utiliser les fonctions RAS (remote access service) :
library : rasapi32.lib
#include "ras.h"
bool IsInternetOpen()
{
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 );
}
voila.