CRasMonitor
v1.41
Welcome to CRasMonitor v1.41, A freeware MFC class to monitor RAS (aka Dial-Up Networking) connections.
| Features |
| Usage |
| History |
| API Reference |
| Planned Enhancements |
| Contacting the Author |
| You need to download the updates | |
| You already have Dial-Up Networking v1.3 or above installed. |
The updated versions are available from the Microsoft Web site. At the time or
writing, you can get the update by clicking here.
If that page has moved (which it has in the past), you can find the update by following
these steps:
For NT users you need to ensure that you have the PSAPI.DLL installed into your system32 directory on NT. If this file is not already present on your machine, then you can download it from http://indigo.ie/~pjn/download/psapi.dll.
V1.0 (5 July 1998)
26 July 1998
v1.1 (1 October 1998)
v1.2 (6 November 1998)
17 November 1998
v1.21 (2 February 1999)
v1.4 (21 February 1999)
v1.41 (25 January 2000)
The API consists of the class CRasConnection and the public member functions of the class CRasMonitor
CRasConnection::m_sName
CRasConnection::m_sDeviceType
CRasConnection::m_sDeviceName
CRasConnection::m_ConnectionTime
CRasConnection::m_DialTime
CRasConnection::m_bConnected
CRasConnection::m_ConnectDuration
CRasConnection::m_DialDuration
CRasConnection::m_HangupTime
CRasConnection::m_dwConnectionSpeed
CRasConnection::m_dwBytesSent
CRasConnection::m_dwBytesReceived
CRasMonitor::Start
CRasMonitor::Stop
Remarks
A string that specifies the phone-book entry used to establish the remote access connection. If the connection was established using an empty entry name, this string consists of a . followed by the connection phone number.
Remarks
A string that specifies the type of the current device, if available. For example, common device types supported by RAS are modem, pad, switch, isdn, or null.
Remarks
A string that specifies the name of the current device, if available. This would be the name of the modem for example, Hayes Smartmodem 2400; the name of the PAD, for example US Sprint; or the name of a switch device, for example Racal-Guardata.
CRasConnection::m_ConnectionTime
Remarks
A SYSTEMTIME representation of when this connection was made/connected. The time stored is Local and not UCT.
Remarks
A SYSTEMTIME representation of when this connection was dialed / attempted. The time stored is Local and not UCT. The dial time will always be more historic than the connection for any connection.
CRasConnection::m_ConnectDuration
Remarks
The number of seconds for which this connection was active.
CRasConnection::m_DialDuration
Remarks
The number of seconds taken to make the connection for which this RAS connection.
Remarks
A SYSTEMTIME representation of when this connection was closed. The time stored is Local and not UCT.
CRasConnection::m_dwConnectionSpeed
Remarks
The connection speed in bits per second for this connection. Please note that this value is always reported as 0 on NT as currently there is no documented way of retrieving this value on NT. Another point to bear in mind is that on 95/98, this is the accumulated connection speed of all current RAS connections. This means that if you are using multilink features or have two separate RAS connections active at the one time, then this value will be the total of both connections.
Remarks
The total number of bytes transmitted by this connection. Please note that this value is a total for all RAS connections similar to the Connection Speed above.
CRasConnection::m_dwBytesReceived
Remarks
The total number of bytes received by this connection. Please note that this value is a total for all RAS connections similar to the Connection Speed above.
BOOL CRasMonitor::Start(CWnd* pNotifyWnd, UINT nNotifyMessage);
Return Value
TRUE if monitoring of RAS connections has started otherwise FALSE.
Parameters
pNotifyWnd Window to send notification messages to
nNotifyMessage the window message to use for notification messages
Remarks
Starts monitoring of active RAS connections. If the call fails, you should use GetLastError to determine the reason. When certain RAS related events occur the class will send a "nNotifyMessage" to pNotifyWnd. The meaning of WPARAM and LPARAM are as follows
| WPARAM | LPARAM | Meaning |
| RAS_DIAL_EVENT | Contains a pointer to the CRasConnection instance which has just dialled. Its type is CRasConnection* | Called when a RAS connection is initially dialled |
| RAS_CONNECT_EVENT | Contains a pointer to the CRasConnection instance which has just connected. Its type is CRasConnection* | Called when a RAS connection has just connected |
| RAS_DISCONNECT_EVENT | Contains a pointer to the CRasConnection instance which has just disconnected. Its type is CRasConnection* | Called when a RAS connection disconnects |
| RAS_CHECK_EVENT | Contains a pointer to the array of current active CRasConnection's. If type is CArray<CRasConnection, CRasConnection&>* | Called periodically with the current RAS connections |
See Also
BOOL CRasMonitor::Stop();
Return Value
TRUE if monitoring of RAS connections has stopped otherwise FALSE.
Parameters
None
Remarks
Stops monitoring of active RAS connections. If the call fails, you should use GetLastError to determine the reason.
See Also
virtual void CRasMonitor::OnDial(const CRasConnection& connection);
Return Value
None
Parameters
connection A class representation of the RAS connection which has just been dialled.
Remarks
Derived classes are responsible for implementing their own version of OnConnect.
See Also
virtual void CRasMonitor::OnConnect(const CRasConnection& connection);
Return Value
None
Parameters
connection A class representation of the RAS connection which has just become active.
Remarks
Derived classes are responsible for implementing their own version of OnConnect.
See Also
virtual void CRasMonitor::OnDisconnect(const CRasConnection& connection);
Return Value
None
Parameters
connection A class representation of the RAS connection which has just being closed.
Remarks
Derived classes are responsible for implementing their own version of OnDisconnect. If you look at the sample app "RasMan", you will see that it does a SendMessage to the mainfrm window.
See Also
virtual void CRasMonitor::OnCheck(RASCONN* pConnections, DWORD dwConnections);
Return Value
None
Parameters
pConnections pointer to an array of the currently active connections. The structure used is the same as that used by native SDK RAS calls.
dwConnections The number of elements in pConnections.
Remarks
This function is called every second internally by CRasMonitor. The parameters it is called with include the an array of the newly active connections. The implementation in CRasMonitor does 2 things.
PJ Naughter
Email: pjn@indigo.ie
Web: http://indigo.ie/~pjn
25 January 2000