RasMonitor.gif (1184 bytes)CRasMonitor v1.21

Welcome to CRasMonitor v1.21, A freeware MFC class to monitor RAS (aka Dial-Up Networking) connections.

 

Features
Usage
History
API Reference
Planned Enhancements
Contacting the Author

 

 

 

Features

 

 

 

Usage

 

 

 

History

V1.0 (5 July 1998)

26 July 1998

v1.1 (1 Octobery 1998)

v1.2 (6 November 1998)

17 November 1998

v1.21 (2 February 1999)

 

API Reference

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
CRasMonitor::Start
CRasMonitor::Stop

 

 

CRasConnection::m_sName

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.

 

CRasConnection::m_sDeviceType

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”.

 

CRasConnection::m_sDeviceName

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.

 

CRasConnection::m_DialTime

Remarks

A SYSTEMTIME representation of when this connection was dialled / 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.

 

CRasConnection::m_HangupTime

Remarks

A SYSTEMTIME representation of when this connection was closed. The time stored is Local and not UCT.

.

CRasMonitor::Start

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

CRasMonitor::Stop

 

CRasMonitor::Stop

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

CRasMonitor::Start

 

CRasMonitor::OnDial

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

CRasMonitor::OnConnect

 

CRasMonitor::OnConnect

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

CRasMonitor::OnDisconnect

 

CRasMonitor::OnDisconnect

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 "RasMon", you will see that it does a SendMessage to the mainfrm window.

See Also

CRasMonitor::OnConnect

 

CRasMonitor::OnCheck

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.

  1. Iterate through all the previously active connections which has now disappeared and call the virtual OnDisconnect function for that connection.
  2. For any new connections which have appeared call the virtual OnConnect for that connection and add it to the internal array of active connections.

 

 

 

PLANNED ENHANCEMENTS

 

 

 

CONTACTING THE AUTHOR

PJ Naughter
Email: pjn@indigo.ie
Web: http://indigo.ie/~pjn
2 February 1999