Click here to Skip to main content
15,899,124 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: arrays Pin
Adam °Wimsatt3-Oct-03 5:44
Adam °Wimsatt3-Oct-03 5:44 
GeneralRe: arrays Pin
Ian Darling3-Oct-03 5:56
Ian Darling3-Oct-03 5:56 
GeneralDetermine when I am connected on LAN Pin
Alan Martinis3-Oct-03 4:00
Alan Martinis3-Oct-03 4:00 
GeneralRe: Determine when I am connected on LAN Pin
Ravi Bhavnani3-Oct-03 5:24
professionalRavi Bhavnani3-Oct-03 5:24 
GeneralRe: Determine when I am connected on LAN Pin
Alexander M.,3-Oct-03 7:42
Alexander M.,3-Oct-03 7:42 
GeneralRe: Determine when I am connected on LAN Pin
Alexander M.,3-Oct-03 7:41
Alexander M.,3-Oct-03 7:41 
GeneralRe: Determine when I am connected on LAN Pin
Alan Martinis3-Oct-03 7:45
Alan Martinis3-Oct-03 7:45 
GeneralRe: Determine when I am connected on LAN Pin
pma3-Oct-03 7:54
pma3-Oct-03 7:54 
Maybe you use this code, its working for all known cases.
ok, its working at least for all my cases

bye
mario


1) InternetCheckConnection ( Checks for Google )
2) InternetAttemptConnect ( Windows Function )
3) IsModem Connected ( Modem Connection )
4) gethostbyname ( Google )
5) InternetGetConnectedState ( LAN )
6) Dont check for Internetconnection



// Check if Online
BOOL WINAPI IsADSLConnected()
{
LPDWORD lpdwFlags=0;
DWORD dwReserved=0;
RASCONN rc;
rc.dwSize = sizeof(rc);
DWORD numConns=0;
DWORD size=0;
DWORD res;

do {

switch(g_m_ConMode) {
case 0:
try {
g_IsConnected=InternetCheckConnection("http://www.google.com",FLAG_ICC_FORCE_CONNECTION ,0);
}
catch(...) {
g_m_ConMode = 4;
}
break;

case 1:
res = InternetAttemptConnect(0);
if(res == ERROR_SUCCESS) g_IsConnected = 1;
else g_IsConnected = 0;
break;

case 2:
// Enumerate the connections.
res = RasEnumConnections(&rc, &size, &numConns);
if (numConns > 0 || InternetGetConnectedState(lpdwFlags,dwReserved)) g_IsConnected = 1;
else g_IsConnected = 0;
break;

case 3:

if (gethostbyname ("www.google.com")) g_IsConnected = 1;
else g_IsConnected = 0;
break;

case 4:

g_IsConnected = 0;

if (::InternetGetConnectedState (&dwReserved, 0)) {
if ((dwReserved & INTERNET_CONNECTION_LAN) ||
(dwReserved & INTERNET_CONNECTION_MODEM) ||
(dwReserved & INTERNET_CONNECTION_PROXY))
{
g_IsConnected = 1;
}
}

break;

case 5:

g_IsConnected = 0;

break;

}

Sleep(2500);
} while(1);
}

GeneralRe: Determine when I am connected on LAN Pin
Alan Martinis3-Oct-03 8:07
Alan Martinis3-Oct-03 8:07 
GeneralRe: Determine when I am connected on LAN Pin
pma3-Oct-03 8:51
pma3-Oct-03 8:51 
GeneralClickable Bitmap UI question Pin
b_girl3-Oct-03 3:58
b_girl3-Oct-03 3:58 
GeneralRe: Clickable Bitmap UI question Pin
Jason Henderson3-Oct-03 5:12
Jason Henderson3-Oct-03 5:12 
GeneralRe: Clickable Bitmap UI question Pin
b_girl3-Oct-03 5:37
b_girl3-Oct-03 5:37 
GeneralRe: Clickable Bitmap UI question Pin
Jason Henderson3-Oct-03 5:45
Jason Henderson3-Oct-03 5:45 
GeneralRe: Clickable Bitmap UI question Pin
b_girl3-Oct-03 5:57
b_girl3-Oct-03 5:57 
GeneralRe: Clickable Bitmap UI question Pin
Jason Henderson3-Oct-03 6:01
Jason Henderson3-Oct-03 6:01 
GeneralRe: Clickable Bitmap UI question Pin
b_girl3-Oct-03 6:40
b_girl3-Oct-03 6:40 
GeneralRe: Clickable Bitmap UI question Pin
Jason Henderson3-Oct-03 6:44
Jason Henderson3-Oct-03 6:44 
GeneralRe: Clickable Bitmap UI question Pin
b_girl3-Oct-03 7:07
b_girl3-Oct-03 7:07 
GeneralRe: Clickable Bitmap UI question Pin
Terry O'Nolley3-Oct-03 8:57
Terry O'Nolley3-Oct-03 8:57 
GeneralRe: Clickable Bitmap UI question Pin
b_girl3-Oct-03 9:05
b_girl3-Oct-03 9:05 
QuestionHow to make a Dialog box Pop up on receiving a event Pin
Deepak Samuel3-Oct-03 3:12
Deepak Samuel3-Oct-03 3:12 
AnswerRe: How to make a Dialog box Pop up on receiving a event Pin
jmkhael3-Oct-03 3:18
jmkhael3-Oct-03 3:18 
AnswerRe: How to make a Dialog box Pop up on receiving a event Pin
David Crow3-Oct-03 7:22
David Crow3-Oct-03 7:22 
Generalconnect or disconnect ADSL Pin
Mnu3-Oct-03 2:01
Mnu3-Oct-03 2:01 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.