My code:
#include <Windows.h>
#include <iostream>
#include <Pdh.h>
#pragma comment (lib, "pdh.lib")
void main()
{
PDH_STATUS Status;
HQUERY Query = NULL;
HCOUNTER Counter;
WCHAR buffer[PDH_MAX_COUNTER_PATH];
PdhOpenQuery(NULL, NULL, &Query);
wcscpy(buffer, L"\\NTO-PROG\Thread(_Total/_Total)\Context Switches/sec");
Status = PdhAddEnglishCounter(Query, buffer, 0, &Counter);
}
I have this error:

English translate:
Access point in procedure PdhAddEnglishCounterA not found in library DLL pdh.dll.
If i'm using PdhAddCounter instead of PdhAddEnglishCounter, i see in Status: 0xC0000BC0 (PDH_CSTATUS_BAD_COUNTERNAME). What I need to do with this?
p.s. I'm using Visual Studio 2010 on Windows XP.
The reason for your error, as MSDN says is that
PdhAddEnglishCounteris not supported on Windows XPFor
PdhAddCounter, the counter path has to be correctly localized. Refer to MSDN here. You might want to considerPdhLookupPerfNameByIndexas an alternative (again, MSDN here).There is a useful article on the MS Knowledgebase too.