NetTrafficButton | CodeGuru

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 […]

Written By
CodeGuru Staff
CodeGuru Staff
Nov 7, 2001
1 minute read
CodeGuru content and product recommendations are editorially independent. We may make money when you click on links to our partners. Learn More

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

CodeGuru Logo

CodeGuru covers topics related to Microsoft-related software development, mobile development, database management, and web application programming. In addition to tutorials and how-tos that teach programmers how to code in Microsoft-related languages and frameworks like C# and .Net, we also publish articles on software development tools, the latest in developer news, and advice for project managers. Cloud services such as Microsoft Azure and database options including SQL Server and MSSQL are also frequently covered.

Property of TechnologyAdvice. © 2026 TechnologyAdvice. All Rights Reserved

Advertiser Disclosure: Some of the products that appear on this site are from companies from which TechnologyAdvice receives compensation. This compensation may impact how and where products appear on this site including, for example, the order in which they appear. TechnologyAdvice does not include all companies or all types of products available in the marketplace.