InteractiveMind
asked on
Function to get CPU usage of specified process
Hello,
I really need a function that will take a string (or equivalent) of the name of a process, and return it's CPU usage at that moment in time.
I've tried coding something myself based on the huge number of stuff in the PAQ's, but am not getting anywhere...
My IDE is Dev-C++.
[BTW, I can guarantee that only 1 process with the specified name will be running at any given time].
Thanks very much !
I really need a function that will take a string (or equivalent) of the name of a process, and return it's CPU usage at that moment in time.
I've tried coding something myself based on the huge number of stuff in the PAQ's, but am not getting anywhere...
My IDE is Dev-C++.
[BTW, I can guarantee that only 1 process with the specified name will be running at any given time].
Thanks very much !
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Hm, 'atlbase.h' is used only in CpuUsage.cpp - and only for 'CRegKey' in
BOOL CCpuUsage::EnablePerformac eCounters( BOOL bEnable)
{
      if (GetPlatform() != WIN2K_XP)
           return TRUE;
      CRegKey regKey;
      if (regKey.Open(HKEY_LOCAL_MA CHINE, "SYSTEM\\CurrentControlSet \\Services \\PerfOS\\ Performanc e") != ERROR_SUCCESS)
           return FALSE;
      regKey.SetValue(!bEnable, "Disable Performance Counters");
      regKey.Close();
      if (regKey.Open(HKEY_LOCAL_MA CHINE, "SYSTEM\\CurrentControlSet \\Services \\PerfProc \\Performa nce") != ERROR_SUCCESS)
           return FALSE;
      regKey.SetValue(!bEnable, "Disable Performance Counters");
      regKey.Close();
      return TRUE;
}
If you change that to regular Win32 Registry APIs, you can just delete the lines
#include "stdafx.h"
#include <atlbase.h> Â Â Â Â Â // for CRegKey use
'comdef.h' however should be availyble with Dev-C++
BOOL CCpuUsage::EnablePerformac
{
      if (GetPlatform() != WIN2K_XP)
           return TRUE;
      CRegKey regKey;
      if (regKey.Open(HKEY_LOCAL_MA
           return FALSE;
      regKey.SetValue(!bEnable, "Disable Performance Counters");
      regKey.Close();
      if (regKey.Open(HKEY_LOCAL_MA
           return FALSE;
      regKey.SetValue(!bEnable, "Disable Performance Counters");
      regKey.Close();
      return TRUE;
}
If you change that to regular Win32 Registry APIs, you can just delete the lines
#include "stdafx.h"
#include <atlbase.h> Â Â Â Â Â // for CRegKey use
'comdef.h' however should be availyble with Dev-C++
ASKER
Perhaps I need to add a library or something ? Â :-\
No, 'comdef.h' is for the basic COM support classes. But you can eliminate this issue by changing
      // Look for instance pInstanceName
      _bstr_t bstrInstance;
      _bstr_t bstrInputInstance = pInstanceName;
      for( int k=0; k < pPerfObj->NumInstances; k++ )
      {
        bstrInstance = (wchar_t *)((PBYTE)pPerfInst + pPerfInst->NameOffset);
        if (!stricmp((LPCTSTR)bstrIns tance, (LPCTSTR)bstrInputInstance ))
        {
          pCounterBlock = (PPERF_COUNTER_BLOCK) ((LPBYTE) pPerfInst + pPerfInst->ByteLength);
          break;
        }
       Â
        // Get the next instance.
        pPerfInst = NextInstance( pPerfInst );
      }
to
      // Look for instance pInstanceName
      wchar_t* bstrInstance;
      wchar_t* bstrInputInstance = new wchar_t[strlen(pInstanceNa me) + 1];
                 mbstowcs(bstrInputInstance ,pInstance Name,strle n(pInstanc eName) + 1);
      for( int k=0; k < pPerfObj->NumInstances; k++ )
      {
        bstrInstance = (wchar_t *)((PBYTE)pPerfInst + pPerfInst->NameOffset);
        if (!_wcsicmp(bstrInstance, bstrInputInstance))
        {
          pCounterBlock = (PPERF_COUNTER_BLOCK) ((LPBYTE) pPerfInst + pPerfInst->ByteLength);
          break;
        }
       Â
        // Get the next instance.
        pPerfInst = NextInstance( pPerfInst );
      }
      delete [] bstrInputInstance;
in 'PerfCounters.h' and substitute 'comdef.h' by 'string.h'
      // Look for instance pInstanceName
      _bstr_t bstrInstance;
      _bstr_t bstrInputInstance = pInstanceName;
      for( int k=0; k < pPerfObj->NumInstances; k++ )
      {
        bstrInstance = (wchar_t *)((PBYTE)pPerfInst + pPerfInst->NameOffset);
        if (!stricmp((LPCTSTR)bstrIns
        {
          pCounterBlock = (PPERF_COUNTER_BLOCK) ((LPBYTE) pPerfInst + pPerfInst->ByteLength);
          break;
        }
       Â
        // Get the next instance.
        pPerfInst = NextInstance( pPerfInst );
      }
to
      // Look for instance pInstanceName
      wchar_t* bstrInstance;
      wchar_t* bstrInputInstance = new wchar_t[strlen(pInstanceNa
                 mbstowcs(bstrInputInstance
      for( int k=0; k < pPerfObj->NumInstances; k++ )
      {
        bstrInstance = (wchar_t *)((PBYTE)pPerfInst + pPerfInst->NameOffset);
        if (!_wcsicmp(bstrInstance, bstrInputInstance))
        {
          pCounterBlock = (PPERF_COUNTER_BLOCK) ((LPBYTE) pPerfInst + pPerfInst->ByteLength);
          break;
        }
       Â
        // Get the next instance.
        pPerfInst = NextInstance( pPerfInst );
      }
      delete [] bstrInputInstance;
in 'PerfCounters.h' and substitute 'comdef.h' by 'string.h'
ASKER
Ah k; that seems to have gotten rid of the comdef.h error message..
As for "change that to regular Win32 Registry APIs" ... how would I do this?
Ta
As for "change that to regular Win32 Registry APIs" ... how would I do this?
Ta
Just like
BOOL CCpuUsage::EnablePerformac eCounters( BOOL bEnable)
{
   if (GetPlatform() != WIN2K_XP)
     return TRUE;
   DWORD dw = bEnable ? 1 : 0;
   HKEY regKey;
   if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MA CHINE, "SYSTEM\\CurrentControlSet \\Services \\PerfOS\\ Performanc e",0, KEY_SET_VALUE, ®Key))
     return FALSE;
   RegSetValueEx(rekKey, "Disable Performance Counters", 0, REG_DWORD, (LPVOID) &dw, sizeof(DWORD));
   RegCloseKey(regKey);
   if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MA CHINE, "SYSTEM\\CurrentControlSet \\Services \\PerfProc \\Performa nce",0, KEY_SET_VALUE, ®Key))
     return FALSE;
   RegSetValueEx(rekKey, "Disable Performance Counters", 0, REG_DWORD, (LPVOID) &dw, sizeof(DWORD));
   RegCloseKey(regKey);
   return TRUE;
}
BOOL CCpuUsage::EnablePerformac
{
   if (GetPlatform() != WIN2K_XP)
     return TRUE;
   DWORD dw = bEnable ? 1 : 0;
   HKEY regKey;
   if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MA
     return FALSE;
   RegSetValueEx(rekKey, "Disable Performance Counters", 0, REG_DWORD, (LPVOID) &dw, sizeof(DWORD));
   RegCloseKey(regKey);
   if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MA
     return FALSE;
   RegSetValueEx(rekKey, "Disable Performance Counters", 0, REG_DWORD, (LPVOID) &dw, sizeof(DWORD));
   RegCloseKey(regKey);
   return TRUE;
}
ASKER
Yup, that's sorted that bit.... now just another 19 error messages :(
They mostly seem to be syntax errors.. :\
Here's my Compile Log:
Compiler: Default compiler
Building Makefile: "C:\Documents and Settings\rob\Desktop\Makef ile.win"
Executing  make...
make.exe -f "C:\Documents and Settings\rob\Desktop\Makef ile.win" all
g++.exe -c CpuUsage_src/CpuUsage.cpp -o CpuUsage_src/CpuUsage.o -I"C:/Program Files/Dev-Cpp/include/c++/ 3.3.1" Â -I"C:/Program Files/Dev-Cpp/include/c++/ 3.3.1/ming w32" Â -I"C:/Program Files/Dev-Cpp/include/c++/ 3.3.1/back ward" Â -I"C:/Program Files/Dev-Cpp/lib/gcc-lib/ mingw32/3. 3.1/includ e" Â -I"C:/Program Files/Dev-Cpp/include" Â -I"C:/Program Files/Java/jdk1.5.0_01/inc lude" Â -I"C:/Program Files/Java/jdk1.5.0_01/inc lude/win32 " Â
CpuUsage_src/CpuUsage.cpp: 47: error: syntax error before numeric constant
CpuUsage_src/CpuUsage.cpp: 48: error: ISO C++ forbids declaration of `PLATFORM'
  with no type
CpuUsage_src/CpuUsage.cpp: 50: error: syntax error before `)' token
CpuUsage_src/CpuUsage.cpp: 53: error: syntax error before `.' token
CpuUsage_src/CpuUsage.cpp: In member function `BOOL
  CCpuUsage::EnablePerformac eCounters( int)':
CpuUsage_src/CpuUsage.cpp: 82: error: `GetPlatform' undeclared (first use this
  function)
CpuUsage_src/CpuUsage.cpp: 82: error: (Each undeclared identifier is reported
  only once for each function it appears in.)
CpuUsage_src/CpuUsage.cpp: 82: error: `WIN2K_XP' undeclared (first use this
  function)
CpuUsage_src/CpuUsage.cpp: 90: error: invalid conversion from `void*' to `const
  BYTE*'
CpuUsage_src/CpuUsage.cpp: 96: error: invalid conversion from `void*' to `const
  BYTE*'
CpuUsage_src/CpuUsage.cpp: In member function `int CCpuUsage::GetCpuUsage()':
CpuUsage_src/CpuUsage.cpp: 111: error: ISO C++ forbids declaration of `PLATFORM'
  with no type
CpuUsage_src/CpuUsage.cpp: 111: error: syntax error before `=' token
CpuUsage_src/CpuUsage.cpp: 131: error: `Platform' undeclared (first use this
  function)
CpuUsage_src/CpuUsage.cpp: In member function `int CCpuUsage::GetCpuUsage(con st
  TCHAR*)':
CpuUsage_src/CpuUsage.cpp: 179: error: ISO C++ forbids declaration of `PLATFORM'
  with no type
CpuUsage_src/CpuUsage.cpp: 179: error: syntax error before `=' token
CpuUsage_src/CpuUsage.cpp: In member function `int CCpuUsage::GetCpuUsage(lon g
  unsigned int)':
CpuUsage_src/CpuUsage.cpp: 226: error: ISO C++ forbids declaration of `PLATFORM'
  with no type
CpuUsage_src/CpuUsage.cpp: 226: error: syntax error before `=' token
CpuUsage_src/PerfCounters. h: In member function `void
  CPerfCounters<T>::CBuffer: :Reset() [with T = LONGLONG]':
CpuUsage_src/PerfCounters. h:140: Â instantiated from `void CPerfCounters<T>::QueryPer formanceDa ta(PERF_DA TA_BLOCK** , long unsigned int, long unsigned int) [with T = LONGLONG]'
CpuUsage_src/PerfCounters. h:22: Â instantiated from `T CPerfCounters<T>::GetCount erValue(PE RF_DATA_BL OCK**, long unsigned int, long unsigned int, const TCHAR*) [with T = LONGLONG]'
CpuUsage_src/CpuUsage.cpp: 151: Â instantiated from here
CpuUsage_src/PerfCounters. h:95: warning: passing NULL used for non-pointer
  argument passing 2 of `void* memset(void*, int, unsigned int)'
CpuUsage_src/PerfCounters. h:95: warning: argument to non-pointer type `int'
  from NULL
make.exe: *** [CpuUsage_src/CpuUsage.o] Error 1
Execution terminated
Is there really no easier way of doing this? :-\
They mostly seem to be syntax errors.. :\
Here's my Compile Log:
Compiler: Default compiler
Building Makefile: "C:\Documents and Settings\rob\Desktop\Makef
Executing  make...
make.exe -f "C:\Documents and Settings\rob\Desktop\Makef
g++.exe -c CpuUsage_src/CpuUsage.cpp -o CpuUsage_src/CpuUsage.o -I"C:/Program Files/Dev-Cpp/include/c++/
CpuUsage_src/CpuUsage.cpp:
CpuUsage_src/CpuUsage.cpp:
  with no type
CpuUsage_src/CpuUsage.cpp:
CpuUsage_src/CpuUsage.cpp:
CpuUsage_src/CpuUsage.cpp:
  CCpuUsage::EnablePerformac
CpuUsage_src/CpuUsage.cpp:
  function)
CpuUsage_src/CpuUsage.cpp:
  only once for each function it appears in.)
CpuUsage_src/CpuUsage.cpp:
  function)
CpuUsage_src/CpuUsage.cpp:
  BYTE*'
CpuUsage_src/CpuUsage.cpp:
  BYTE*'
CpuUsage_src/CpuUsage.cpp:
CpuUsage_src/CpuUsage.cpp:
  with no type
CpuUsage_src/CpuUsage.cpp:
CpuUsage_src/CpuUsage.cpp:
  function)
CpuUsage_src/CpuUsage.cpp:
  TCHAR*)':
CpuUsage_src/CpuUsage.cpp:
  with no type
CpuUsage_src/CpuUsage.cpp:
CpuUsage_src/CpuUsage.cpp:
  unsigned int)':
CpuUsage_src/CpuUsage.cpp:
  with no type
CpuUsage_src/CpuUsage.cpp:
CpuUsage_src/PerfCounters.
  CPerfCounters<T>::CBuffer:
CpuUsage_src/PerfCounters.
CpuUsage_src/PerfCounters.
CpuUsage_src/CpuUsage.cpp:
CpuUsage_src/PerfCounters.
  argument passing 2 of `void* memset(void*, int, unsigned int)'
CpuUsage_src/PerfCounters.
  from NULL
make.exe: *** [CpuUsage_src/CpuUsage.o] Error 1
Execution terminated
Is there really no easier way of doing this? :-\
Nope. But, the error mainly boils down to
typedef enum
{
      WINNT,      WIN2K_XP, WIN9X, UNKNOWN
}PLATFORM;
which is actually valid. You could try
enum PLATFORM
{
      WINNT,      WIN2K_XP, WIN9X, UNKNOWN
};
typedef enum
{
      WINNT,      WIN2K_XP, WIN9X, UNKNOWN
}PLATFORM;
which is actually valid. You could try
enum PLATFORM
{
      WINNT,      WIN2K_XP, WIN9X, UNKNOWN
};
ASKER
Hmm; making that change is now resulting in 23 errors  :-\
What about
enum _PLATFORM
{
   WINNT,   WIN2K_XP, WIN9X, UNKNOWN
} PLATFORM;
?
If this also goes wrong, make that
typedef int PLATFORM;
#define WINNT 1
#define WIN2K_XP 2
#define WIN9X 3
#define UNKNOWN -1
enum _PLATFORM
{
   WINNT,   WIN2K_XP, WIN9X, UNKNOWN
} PLATFORM;
?
If this also goes wrong, make that
typedef int PLATFORM;
#define WINNT 1
#define WIN2K_XP 2
#define WIN9X 3
#define UNKNOWN -1
ASKER
Okay, the last suggestion sorts most of that....
Just 5 errors left  :)
Compiler: Default compiler
Building Makefile: "C:\Documents and Settings\rob\Desktop\Makef ile.win"
Executing  make...
make.exe -f "C:\Documents and Settings\rob\Desktop\Makef ile.win" all
g++.exe -c CpuUsage_src/CpuUsage.cpp -o CpuUsage_src/CpuUsage.o -I"C:/Program Files/Dev-Cpp/include/c++/ 3.3.1" Â -I"C:/Program Files/Dev-Cpp/include/c++/ 3.3.1/ming w32" Â -I"C:/Program Files/Dev-Cpp/include/c++/ 3.3.1/back ward" Â -I"C:/Program Files/Dev-Cpp/lib/gcc-lib/ mingw32/3. 3.1/includ e" Â -I"C:/Program Files/Dev-Cpp/include" Â -I"C:/Program Files/Java/jdk1.5.0_01/inc lude" Â -I"C:/Program Files/Java/jdk1.5.0_01/inc lude/win32 " Â
CpuUsage_src/CpuUsage.cpp: In member function `BOOL
  CCpuUsage::EnablePerformac eCounters( int)':
CpuUsage_src/CpuUsage.cpp: 90: error: invalid conversion from `void*' to `const
  BYTE*'
CpuUsage_src/CpuUsage.cpp: 96: error: invalid conversion from `void*' to `const
  BYTE*'
CpuUsage_src/PerfCounters. h: In member function `void
  CPerfCounters<T>::CBuffer: :Reset() [with T = LONGLONG]':
CpuUsage_src/PerfCounters. h:140: Â instantiated from `void CPerfCounters<T>::QueryPer formanceDa ta(PERF_DA TA_BLOCK** , long unsigned int, long unsigned int) [with T = LONGLONG]'
CpuUsage_src/PerfCounters. h:22: Â instantiated from `T CPerfCounters<T>::GetCount erValue(PE RF_DATA_BL OCK**, long unsigned int, long unsigned int, const TCHAR*) [with T = LONGLONG]'
CpuUsage_src/CpuUsage.cpp: 151: Â instantiated from here
CpuUsage_src/PerfCounters. h:95: warning: passing NULL used for non-pointer
  argument passing 2 of `void* memset(void*, int, unsigned int)'
CpuUsage_src/PerfCounters. h:95: warning: argument to non-pointer type `int'
  from NULL
make.exe: *** [CpuUsage_src/CpuUsage.o] Error 1
Execution terminated
:D
Just 5 errors left  :)
Compiler: Default compiler
Building Makefile: "C:\Documents and Settings\rob\Desktop\Makef
Executing  make...
make.exe -f "C:\Documents and Settings\rob\Desktop\Makef
g++.exe -c CpuUsage_src/CpuUsage.cpp -o CpuUsage_src/CpuUsage.o -I"C:/Program Files/Dev-Cpp/include/c++/
CpuUsage_src/CpuUsage.cpp:
  CCpuUsage::EnablePerformac
CpuUsage_src/CpuUsage.cpp:
  BYTE*'
CpuUsage_src/CpuUsage.cpp:
  BYTE*'
CpuUsage_src/PerfCounters.
  CPerfCounters<T>::CBuffer:
CpuUsage_src/PerfCounters.
CpuUsage_src/PerfCounters.
CpuUsage_src/CpuUsage.cpp:
CpuUsage_src/PerfCounters.
  argument passing 2 of `void* memset(void*, int, unsigned int)'
CpuUsage_src/PerfCounters.
  from NULL
make.exe: *** [CpuUsage_src/CpuUsage.o] Error 1
Execution terminated
:D
I use boost::progress_timer.
Check out following link:
http://athene.berlios.de/classboost_1_1progress__timer.html
Check out following link:
http://athene.berlios.de/classboost_1_1progress__timer.html
Ah, getting closer - that should be
BOOL CCpuUsage::EnablePerformac eCounters( BOOL bEnable)
{
   if (GetPlatform() != WIN2K_XP)
     return TRUE;
   DWORD dw = bEnable ? 1 : 0;
   HKEY regKey;
   if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MA CHINE, "SYSTEM\\CurrentControlSet \\Services \\PerfOS\\ Performanc e",0, KEY_SET_VALUE, ®Key))
     return FALSE;
   RegSetValueEx(rekKey, "Disable Performance Counters", 0, REG_DWORD, (LPBYTE) &dw, sizeof(DWORD));
   RegCloseKey(regKey);
   if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MA CHINE, "SYSTEM\\CurrentControlSet \\Services \\PerfProc \\Performa nce",0, KEY_SET_VALUE, ®Key))
     return FALSE;
   RegSetValueEx(rekKey, "Disable Performance Counters", 0, REG_DWORD, (LPBYTE) &dw, sizeof(DWORD));
   RegCloseKey(regKey);
   return TRUE;
}
The rest are only warnings.
BOOL CCpuUsage::EnablePerformac
{
   if (GetPlatform() != WIN2K_XP)
     return TRUE;
   DWORD dw = bEnable ? 1 : 0;
   HKEY regKey;
   if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MA
     return FALSE;
   RegSetValueEx(rekKey, "Disable Performance Counters", 0, REG_DWORD, (LPBYTE) &dw, sizeof(DWORD));
   RegCloseKey(regKey);
   if (ERROR_SUCCESS != RegOpenKeyEx(HKEY_LOCAL_MA
     return FALSE;
   RegSetValueEx(rekKey, "Disable Performance Counters", 0, REG_DWORD, (LPBYTE) &dw, sizeof(DWORD));
   RegCloseKey(regKey);
   return TRUE;
}
The rest are only warnings.
ASKER
Okay, one last thing:
CpuUsage_src/PerfCounters. h: In member function `void
  CPerfCounters<T>::CBuffer: :Reset() [with T = LONGLONG]':
CpuUsage_src/PerfCounters. h:140: Â instantiated from `void CPerfCounters<T>::QueryPer formanceDa ta(PERF_DA TA_BLOCK** , long unsigned int, long unsigned int) [with T = LONGLONG]'
CpuUsage_src/PerfCounters. h:22: Â instantiated from `T CPerfCounters<T>::GetCount erValue(PE RF_DATA_BL OCK**, long unsigned int, long unsigned int, const TCHAR*) [with T = LONGLONG]'
CpuUsage_src/CpuUsage.cpp: 151: Â instantiated from here
Apparently it doesn't like this line in PerfCounters.h:
Buffer.Reset();
?
CpuUsage_src/PerfCounters.
  CPerfCounters<T>::CBuffer:
CpuUsage_src/PerfCounters.
CpuUsage_src/PerfCounters.
CpuUsage_src/CpuUsage.cpp:
Apparently it doesn't like this line in PerfCounters.h:
Buffer.Reset();
?
ASKER
Oh, that's the warning thing....
nvm :)
Is there a way to disable warnings in Dev-C++ ? :)
nvm :)
Is there a way to disable warnings in Dev-C++ ? :)
ASKER
Okay, that's all compiling fine now, and has produced an exe :)
However ...
When I run the program, the "SystemWide Cpu Usage" is stuck at 100%, and the other two measurements are both at 0%...
(But, if I run the pre-compiled demo from that site, it's giving correct output..)
However ...
When I run the program, the "SystemWide Cpu Usage" is stuck at 100%, and the other two measurements are both at 0%...
(But, if I run the pre-compiled demo from that site, it's giving correct output..)
Can you check the registry whether the flags have been set correctly?
ASKER
If you mean:
HKLM\SYSTEM\CurrentControl Set\Servic es\PerfOS\ Performanc e\Disable Performance Counters
and
HKLM\SYSTEM\CurrentControl Set\Servic es\PerfPro c\Performa nce\Disabl e Performance Counters
Then yes, they exist (both with value 0x00000001) ...
HKLM\SYSTEM\CurrentControl
and
HKLM\SYSTEM\CurrentControl
Then yes, they exist (both with value 0x00000001) ...
Ah, that's the problem - change
   DWORD dw = bEnable ? 1 : 0;
to
   DWORD dw = bEnable ? 0 : 1;
   DWORD dw = bEnable ? 1 : 0;
to
   DWORD dw = bEnable ? 0 : 1;
ASKER
..And it works !!!
Magic.
Thanks very much for going through this with me, jkr.. I tried to get this thing working many months ago - with no luck.
So, I'm really happy now :D
Thanks !!
Magic.
Thanks very much for going through this with me, jkr.. I tried to get this thing working many months ago - with no luck.
So, I'm really happy now :D
Thanks !!
You're most welcome ;o)
ASKER
By the way; it would seem that the GetCpuUsage() returns 0 the first time it's called [everytime].. This is quite obvious when looking at the code... but is there a way to retrieve the CPU usage with only a single call to that function? (Because I need to shove it into a DLL, and calling that function twice within the DLL doesn't seem to be working...)
I think that I've had more than my share of help in this thread [for just 500 points] -- so have posted a new thread regarding this problem. :)
https://www.experts-exchange.com/questions/21790438/Follow-up-Function-to-get-CPU-usage-of-specified-process.html
Cheers.
I think that I've had more than my share of help in this thread [for just 500 points] -- so have posted a new thread regarding this problem. :)
https://www.experts-exchange.com/questions/21790438/Follow-up-Function-to-get-CPU-usage-of-specified-process.html
Cheers.
ASKER
I've shoved the source files provided in that link into a new project in Dev-C++, and have tried to compile - but am getting a load of errors...
Just a few of which area:
atlbase.h: No such file or directory.
comdef.h: No such file or directory.
.
.
and a few syntax errors..
Any ideas ?
Thanks