Click here to Skip to main content
15,894,017 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: System Query Pin
john563229-Dec-11 20:29
john563229-Dec-11 20:29 
GeneralRe: System Query Pin
Randor 29-Dec-11 21:57
professional Randor 29-Dec-11 21:57 
QuestionJoining 2 values with wcsncat_s Pin
jkirkerx26-Dec-11 10:52
professionaljkirkerx26-Dec-11 10:52 
AnswerRe: Joining 2 values with wcsncat_s Pin
Chris Losinger26-Dec-11 10:59
professionalChris Losinger26-Dec-11 10:59 
GeneralRe: Joining 2 values with wcsncat_s Pin
jkirkerx26-Dec-11 11:13
professionaljkirkerx26-Dec-11 11:13 
QuestionNetwork Utilization Pin
john563225-Dec-11 22:13
john563225-Dec-11 22:13 
AnswerRe: Network Utilization Pin
Richard MacCutchan26-Dec-11 6:57
mveRichard MacCutchan26-Dec-11 6:57 
AnswerRe: Network Utilization Pin
Randor 26-Dec-11 12:17
professional Randor 26-Dec-11 12:17 
Hi,

Have a look at this older post:

How to get the network adapter connection speed using IP Helper Library.[^]

Using the code snippet above you could get the maximum speed available. (Always read the MSDN article! If you want to support gigabit speeds... you will need to modify my code to use the MIB_IF_ROW2 structure[^])

If you wanted to know what percentage of the available network capacity is being currently utilized... just modify the code sample above and obtain the:

MIB_IFROW[^].dwInOctets for incoming
MIB_IFROW[^].dwOutOctets for outgoing

1.) Save these values...
2.) Wait 1 second. (Or wait a smaller amount such as 250 milliseconds)
3.) Read the values again... and subtract current value from last value. (if you waited a short amount of time such as 250 milliseconds then multiply by 4 to estimate 1000 milliseconds)

Actually the MIB_IF_ROW2 structure[^] looks like a better candidate... it uses unsigned 64 bit integers for the counters. So I suggest that you update the function to use that instead.

Also... If you look closely at the link I gave you above... David Crow and mikey_eff[^] also shows how to get these same values using PDH (Performance Counters). So you have two choices.

I often have people ask me why I always choose the lower level functions... and PDH is a perfect example. Users have the ability to disable performance counters. So if you write an application that reads cpu/network statistics using Performance Counters... and a user named Bob disabled his performance counters... then your application will fail on Bob's computer. Microsoft Windows is somewhat like an Onion[^] and the PDH network counters are actually reading the same values accessed by the IP Helper[^] library that are tracked by the NT modular kernel. The Performance Data Helper is continually reading all these values and stores them in the registry...

Anyway it looks like I am rambling again, hope it makes sense. I better get back to eating pumpkin pie.

Best Wishes,
-David Delaune
QuestionDetect keypress count Pin
juver escolta23-Dec-11 6:04
juver escolta23-Dec-11 6:04 
AnswerRe: Detect keypress count Pin
CPallini23-Dec-11 7:34
mveCPallini23-Dec-11 7:34 
AnswerRe: Detect keypress count Pin
Luc Pattyn24-Dec-11 2:21
sitebuilderLuc Pattyn24-Dec-11 2:21 
GeneralRe: Detect keypress count Pin
CPallini24-Dec-11 3:59
mveCPallini24-Dec-11 3:59 
AnswerRe: Detect keypress count Pin
Luc Pattyn24-Dec-11 4:06
sitebuilderLuc Pattyn24-Dec-11 4:06 
GeneralRe: Detect keypress count Pin
CPallini24-Dec-11 4:42
mveCPallini24-Dec-11 4:42 
QuestionRe: Detect keypress count Pin
David Crow23-Dec-11 9:28
David Crow23-Dec-11 9:28 
AnswerRe: Detect keypress count Pin
Gary R. Wheeler23-Dec-11 23:56
Gary R. Wheeler23-Dec-11 23:56 
AnswerRe: Detect keypress count Pin
Lactoferrin24-Dec-11 1:45
Lactoferrin24-Dec-11 1:45 
AnswerRe: Detect keypress count Pin
Software_Developer24-Dec-11 4:54
Software_Developer24-Dec-11 4:54 
QuestionHow GetObjectSchema() to work ? Pin
André Dewispelaere23-Dec-11 3:43
André Dewispelaere23-Dec-11 3:43 
AnswerRe: How GetObjectSchema() to work ? Pin
Mohibur Rashid26-Dec-11 22:13
professionalMohibur Rashid26-Dec-11 22:13 
QuestionHow to Delete A Node with its all Child in XML File ? Pin
002comp22-Dec-11 23:18
002comp22-Dec-11 23:18 
AnswerRe: How to Delete A Node with its all Child in XML File ? Pin
CPallini22-Dec-11 23:40
mveCPallini22-Dec-11 23:40 
AnswerRe: How to Delete A Node with its all Child in XML File ? Pin
jschell23-Dec-11 10:01
jschell23-Dec-11 10:01 
QuestionFinding an item in linked list (CList) Pin
VCProgrammer22-Dec-11 19:00
VCProgrammer22-Dec-11 19:00 
AnswerRe: Finding an item in linked list (CList) Pin
Richard MacCutchan22-Dec-11 22:45
mveRichard MacCutchan22-Dec-11 22:45 

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.