Click here to Skip to main content
15,914,406 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Bitwise operators, static cast and Position pointers Pin
Michael Dunn27-Dec-01 7:10
sitebuilderMichael Dunn27-Dec-01 7:10 
GeneralRe: Bitwise operators, static cast and Position pointers Pin
27-Dec-01 7:40
suss27-Dec-01 7:40 
GeneralRe: Bitwise operators, static cast and Position pointers Pin
Tim Smith27-Dec-01 7:46
Tim Smith27-Dec-01 7:46 
GeneralRe: Bitwise operators, static cast and Position pointers Pin
27-Dec-01 12:19
suss27-Dec-01 12:19 
GeneralRAS...I don't get him! Pin
BlackSmith27-Dec-01 6:02
BlackSmith27-Dec-01 6:02 
GeneralRe: RAS...I don't get him! Pin
Masaaki Onishi27-Dec-01 7:02
Masaaki Onishi27-Dec-01 7:02 
GeneralRe: RAS...I don't get him! Pin
Joel Lucsy27-Dec-01 8:43
Joel Lucsy27-Dec-01 8:43 
GeneralRe: RAS...I don't get him! Pin
Rickard Andersson2027-Dec-01 8:57
Rickard Andersson2027-Dec-01 8:57 
This code checks if you are connected to internet, guess that is what you want (paste it into a file and include the file in the file that you call IsRasConnected()):

// It return TRUE if yes or FALSE is not

//// RAS Connect status function
////
//// Written by Gilad Novik
//// For any questions or comments, gilad@bmidas.com


#ifndef _RASSTATUS
#define _RASSTATUS
#include <ras.h>


// We need to declare the functions type
typedef DWORD (WINAPI *RasEnumConnectionsType)(LPRASCONN lprasconn,LPDWORD lpcb,LPDWORD lpcConnections);
typedef DWORD (WINAPI *RasGetConnectStatusType)(HRASCONN hrasconn,LPRASCONNSTATUS lprasconnstatus);

#ifdef _UNICODE
#define RasFileName L"RASAPI32.DLL"
#define RasEnumConnectionsName L"RasEnumConnectionsW"
#define RasGetConnectStatusName L"RasGetConnectStatusW"
#else
#define RasFileName "RASAPI32.DLL"
#define RasEnumConnectionsName "RasEnumConnectionsA"
#define RasGetConnectStatusName "RasGetConnectStatusA"
#endif

BOOL IsRasConnected()
{
HINSTANCE hLib = LoadLibrary(RasFileName); // Try to load the library
if (hLib == NULL)
return FALSE; // Return FALSE if we can't find it

// Get functions address
RasEnumConnectionsType _RasEnumConnections = (RasEnumConnectionsType)GetProcAddress(hLib,RasEnumConnectionsName);
RasGetConnectStatusType _RasGetConnectStatus = (RasGetConnectStatusType)GetProcAddress(hLib,RasGetConnectStatusName);
BOOL bResult = FALSE;
if (_RasEnumConnections && _RasGetConnectStatus) // Check if it is valid pointer
{
RASCONN RasConn;
RASCONNSTATUS RasConnStatus;
RasConnStatus.dwSize = sizeof(RASCONNSTATUS); // We need to set the size of the structure
DWORD dwConnSize = sizeof(RASCONN);
DWORD dwRasCount = 1; // We only retrieve one connection
RasConn.dwSize = dwConnSize; // We need to set the size of the structure
bResult = // Let's check it out !!!
(((*_RasEnumConnections)(&RasConn,&dwConnSize,&dwRasCount)) == 0)
&& (((*_RasGetConnectStatus)(RasConn.hrasconn,&RasConnStatus)) == 0)
&& (RasConnStatus.rasconnstate == RASCS_Connected);
}
FreeLibrary(hLib); // Don't forget to unload the library from memory
return bResult;
}
#endif // _RASSTATUS

------------------------------
©0d3 ©®4©k3® - That's me! Smile | :)
------------------------------
GeneralIssues opening files Pin
Stew27-Dec-01 5:51
Stew27-Dec-01 5:51 
GeneralRe: Issues opening files Pin
Chris Meech27-Dec-01 9:29
Chris Meech27-Dec-01 9:29 
GeneralRe: Issues opening files Pin
Stew28-Dec-01 4:45
Stew28-Dec-01 4:45 
GeneralTurning on/off caps lock, num lock and scroll lock Pin
Nnamdi Onyeyiri27-Dec-01 5:34
Nnamdi Onyeyiri27-Dec-01 5:34 
GeneralRe: Turning on/off caps lock, num lock and scroll lock Pin
Chris Meech27-Dec-01 9:34
Chris Meech27-Dec-01 9:34 
GeneralRe: Turning on/off caps lock, num lock and scroll lock Pin
567890123430-Dec-01 1:46
567890123430-Dec-01 1:46 
QuestionModems-Connected or Not? Pin
BlackSmith27-Dec-01 1:46
BlackSmith27-Dec-01 1:46 
AnswerRe: Modems-Connected or Not? Pin
Nish Nishant27-Dec-01 1:58
sitebuilderNish Nishant27-Dec-01 1:58 
GeneralFile size in FTP server... Pin
27-Dec-01 1:22
suss27-Dec-01 1:22 
GeneralBeeep! Pin
Rickard Andersson2027-Dec-01 1:19
Rickard Andersson2027-Dec-01 1:19 
GeneralRe: Beeep! Pin
Nish Nishant27-Dec-01 1:23
sitebuilderNish Nishant27-Dec-01 1:23 
GeneralRe: Beeep! Pin
Rickard Andersson2027-Dec-01 1:44
Rickard Andersson2027-Dec-01 1:44 
GeneralRe: Beeep! Pin
Nish Nishant27-Dec-01 1:48
sitebuilderNish Nishant27-Dec-01 1:48 
GeneralRe: Beeep! Pin
Christian Graus27-Dec-01 14:56
protectorChristian Graus27-Dec-01 14:56 
GeneralRe: Beeep! Pin
Nish Nishant27-Dec-01 16:21
sitebuilderNish Nishant27-Dec-01 16:21 
Generalhttps Pin
Sonu Kapoor27-Dec-01 1:05
Sonu Kapoor27-Dec-01 1:05 
GeneralRe: https Pin
Nish Nishant27-Dec-01 1:25
sitebuilderNish Nishant27-Dec-01 1:25 

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.