Click here to Skip to main content
15,913,361 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralCFileDialog Pin
Kamesh27-Oct-03 21:08
Kamesh27-Oct-03 21:08 
Generalpath of my documents folder Pin
r i s h a b h s27-Oct-03 20:59
r i s h a b h s27-Oct-03 20:59 
GeneralRe: path of my documents folder Pin
iceage27-Oct-03 21:14
iceage27-Oct-03 21:14 
GeneralRe: path of my documents folder Pin
Neville Franks27-Oct-03 22:15
Neville Franks27-Oct-03 22:15 
GeneralRe: path of my documents folder Pin
r i s h a b h s28-Oct-03 18:31
r i s h a b h s28-Oct-03 18:31 
QuestionHow to get the current traffic bandwidth of computer? Pin
George227-Oct-03 20:31
George227-Oct-03 20:31 
AnswerRe: How to get the current traffic bandwidth of computer? Pin
Mike Dimmick28-Oct-03 1:54
Mike Dimmick28-Oct-03 1:54 
GeneralRe: How to get the current traffic bandwidth of computer? Pin
George228-Oct-03 23:51
George228-Oct-03 23:51 
Thanks, Mike buddy!

I have taken some time to read the API you introduced to me. They are really helpful. I am using the following source code to get in/out traffic bandwidth, but the output is always zero. Can you help?

Source Code:

----------
#include <windows.h>
#include <conio.h>
#include <stdio.h>
#include <pdh.h>
#include "iphlpapi.h"
#include "Iptypes.h"
#include "Iprtrmib.h"

#pragma comment(lib,"iphlpapi.lib")

int main (int argc, char** argv)
{
unsigned long pOutBufLen = sizeof (IP_ADAPTER_INFO);
IP_ADAPTER_INFO AdapterInfo;
memset (&AdapterInfo, 0, sizeof (IP_ADAPTER_INFO));
MIB_IFROW ifrow;
DWORD last_sent, last_recv, current_sent, current_recv;
DWORD diftime, dlwinspeed, upwinspeed, dw_refreshtime;

if( GetAdaptersInfo(&AdapterInfo, &pOutBufLen) != ERROR_SUCCESS ){
printf("Could not open default interface!");
return ( 0 );
}

ifrow.dwIndex = AdapterInfo.Index;
if( GetIfEntry( &ifrow ) != NO_ERROR ) {
printf("Could not open default interface!");
return ( 0 );
}

while (1)
{
current_sent = ifrow.dwOutOctets - last_sent;
current_recv = ifrow.dwInOctets - last_recv;
last_sent = ifrow.dwOutOctets;
last_recv = ifrow.dwInOctets;
printf ("Octs out: %ld\n", ifrow.dwOutOctets);
printf ("Octs in: %ld\n", ifrow.dwInOctets);
diftime=(GetTickCount()-dw_refreshtime);
dlwinspeed = current_recv/diftime;
upwinspeed = current_sent/diftime;
dw_refreshtime=GetTickCount();
printf ("Band in: %ld\n", dlwinspeed);
printf ("Band out: %ld\n", upwinspeed);
Sleep (5000);
}

return 0;
}
----------


Best regards,
Geo
Generalmmc dialog windows Pin
Colin Grealy27-Oct-03 20:06
Colin Grealy27-Oct-03 20:06 
Questionproblem cdatetimectrl in package? Pin
murali_utr27-Oct-03 19:56
murali_utr27-Oct-03 19:56 
AnswerRe: problem cdatetimectrl in package? Pin
ananth_xyz27-Oct-03 22:09
ananth_xyz27-Oct-03 22:09 
GeneralRe: problem cdatetimectrl in package? Pin
murali_utr27-Oct-03 23:00
murali_utr27-Oct-03 23:00 
QuestionHow to get HMODULE/HINSTANCE handle of a different application? Pin
kvcrajan27-Oct-03 18:45
kvcrajan27-Oct-03 18:45 
AnswerRe: How to get HMODULE/HINSTANCE handle of a different application? Pin
yndfcd27-Oct-03 19:31
yndfcd27-Oct-03 19:31 
Generalftp client using vc++ and winsock Pin
pampatipraveen27-Oct-03 17:45
pampatipraveen27-Oct-03 17:45 
GeneralRe: ftp client using vc++ and winsock Pin
georgiek5027-Oct-03 20:03
georgiek5027-Oct-03 20:03 
GeneralHTMLView Pin
Giang Pham 7827-Oct-03 17:02
Giang Pham 7827-Oct-03 17:02 
GeneralRe: HTMLView Pin
Neville Franks27-Oct-03 22:17
Neville Franks27-Oct-03 22:17 
GeneralRich Edit: select all Pin
halblonious27-Oct-03 16:52
halblonious27-Oct-03 16:52 
GeneralRe: Rich Edit: select all Pin
Mumiozol28-Oct-03 0:25
Mumiozol28-Oct-03 0:25 
GeneralRe: Rich Edit: select all Pin
jhwurmbach28-Oct-03 1:22
jhwurmbach28-Oct-03 1:22 
GeneralRe: Rich Edit: select all Pin
Mumiozol28-Oct-03 2:28
Mumiozol28-Oct-03 2:28 
GeneralRe: Rich Edit: select all Pin
halblonious28-Oct-03 9:39
halblonious28-Oct-03 9:39 
QuestionWhat are the advantages of a string table? Pin
Daniel132427-Oct-03 16:06
Daniel132427-Oct-03 16:06 
AnswerRe: What are the advantages of a string table? Pin
Oinka27-Oct-03 16:19
Oinka27-Oct-03 16:19 

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.