NetTrafficButton

Environment: VC6 SP4, Win2000

This little control, derived from a CButton control, displays the network traffic on a given interface. It uses the Performace API functions to enumerate the current traffic.

Usage:

1. Copy files

To use this control in your project, simply copy the two classes
MFNetTraffic
MFNetTrafficButton
into your project directory (also copy the globals.h file, which includes the necessary definitions and types).

2.Create helper button

Create a CButton control in your e.g. Dialog and overwrite the type with MFNetTrafficButton.

3. Initalization

Initialize the control with the right values. These are:

MFNetTrafficButton.SetInterfaceNumber(SelectedInterface);
This initializes the control to monitor the interface given. You can obtain this value by calling the MFNetTraffic::GetNetworkInterfacesCount() method.

MFNetTrafficButton.SelectTrafficType(MFTrafficButton::Traffic_Total);
Sets the type of the traffic to monitor. Possible values are:
Traffic_Total
Traffic_Incoming
Traffic_Outgoing

MFNetTrafficButton.SetInterfaceNumberNotificationFunction(interfaceHasChanged);
If you are interested in being notificated if a control changes the number of the interface.

MFNetTrafficButton.SetUpdateSpeed(timerresolution, gridresolution);
Specifies how fast the grid should scroll and how often the control should update the network traffic information (both values are in milliseconds).

Downloads

Download demo project - 47 Kb
Download source - 12 Kb