i am currently trying to make some sort of CPU usage overview for my DirectX program, but it seems that i am not able to get this information through PdhAddCounter(). My code looks like this:
status = PdhOpenQuery(NULL, 0, &m_queryHandle);
if(status != ERROR_SUCCESS)
{
m_canReadCpu = false;
}
status = PdhAddCounter(m_queryHandle, TEXT("\\Processor(_Total)\\% processor time"), 0, &m_counterHandle);
if(status != ERROR_SUCCESS)
{
m_canReadCpu = false;
}
After the PdhAddCounter call my status is = -1073738824, wich causes the program to fail.
Im using a Windows 7 64bit system, do i have to make something different in a 64bit environment? Thanks for any help.