Click to See Complete Forum and Search --> : How to detect when we connect to internet


abrar
June 3rd, 1999, 08:13 AM
I want notification to my s/w when connected to internet

Ghazi /Dundas
June 18th, 1999, 03:38 PM
Use

BOOL InternetCheckConnection(
IN LPCSTR lpszUrl,
IN DWORD dwFlags,
IN DWORD dwReserved
);
with lpszUrl as NULL

HTH
Ghazi


ghaziw@dundas.com
Dundas Software

Colin Davies
June 19th, 1999, 11:01 PM
I've been using this successfully


DWORD lpdwFlags ;//= INTERNET_CONNECTION_MODEM|INTERNET_CONNECTION_LAN|INTERNET_CONNECTION_PROXY ;
if( InternetGetConnectedState(&lpdwFlags ,0) == TRUE){ ....}





maybe - InternetCheckConnection works as well, but I thought it checked to see if you could connect.. Oh well

Regards
Colin Davies

At the Mount

Daniel Frey
June 20th, 1999, 03:12 PM
Hi,
I had once the same problem. Here the code to get the connections open to the net.
If the enumeration returns NOT 0, there is no connection. Else you can even see which ones are open.


RASCONN ras[20];
DWORD dSize,dNumber,dCount;

ras[0].dwSize = sizeof(RASCONN);
dSize = sizeof( ras ); // Get active RAS - Connection

if( RasEnumConnections( ras, &dSize, &dNumber ) == 0 )
{
for( dCount = 0; dCount < dNumber; dCount++ )
{
do something
}
}




Have fun
Dan