Click here to Skip to main content
15,912,072 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Searching for direction Pin
Adam °Wimsatt3-Oct-03 8:20
Adam °Wimsatt3-Oct-03 8:20 
GeneralRe: Searching for direction Pin
Neville Franks4-Oct-03 12:14
Neville Franks4-Oct-03 12:14 
GeneralRe: Searching for direction Pin
Peter Weyzen3-Oct-03 9:25
Peter Weyzen3-Oct-03 9:25 
GeneralRe: Searching for direction Pin
Adam °Wimsatt3-Oct-03 9:51
Adam °Wimsatt3-Oct-03 9:51 
GeneralRe: Searching for direction Pin
Peter Weyzen3-Oct-03 9:56
Peter Weyzen3-Oct-03 9:56 
GeneralFFT Pin
AdventureBoy3-Oct-03 5:56
AdventureBoy3-Oct-03 5:56 
GeneralRe: FFT Pin
Adam °Wimsatt3-Oct-03 6:00
Adam °Wimsatt3-Oct-03 6:00 
GeneralRe: FFT Pin
Orhun Birsoy3-Oct-03 8:34
Orhun Birsoy3-Oct-03 8:34 
QuestionWhy does my stretchblt always fail? Pin
Jason Henderson3-Oct-03 5:16
Jason Henderson3-Oct-03 5:16 
AnswerRe: Why does my stretchblt always fail? Pin
PJ Arends3-Oct-03 6:44
professionalPJ Arends3-Oct-03 6:44 
Generalarrays Pin
NewHSKid3-Oct-03 5:14
NewHSKid3-Oct-03 5:14 
GeneralRe: arrays Pin
jmkhael3-Oct-03 5:39
jmkhael3-Oct-03 5:39 
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 

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.