Click to See Complete Forum and Search --> : Compile Problems in Multiple-OS!


qexing
November 16th, 2005, 10:50 PM
I want to use pdh.dll in my program, and I know it's not included in win98/95, but win2000 support it...
While I use it like this:
#include <pdh.h>
#pragma comment (lib,"Pdh.lib")
And in win98, it always give me a "can't found pdh.dll" error.

I have tried to use this:
#ifdef _WIN32_NT
#include <pdh.h>
#pragma comment (lib,"Pdh.lib")
#endif
But the error occurs again...
----------------------------------------------------------------------
And I try LoadLibrary and GetProcAddress, but the function "PdhAddCounterA" is always successfully loaded, but while I invoke it, it always returns error(Not ERROR_SUCCESS)

Can you help me to use pdh.dll in NT Os? Thank you!!

Boris K K
November 17th, 2005, 04:57 AM
To clear some possibilities:

You say "error", not "exception", right? There is a known problem with PdhAddCounter on early Windows 2000 versions:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q264629
You call PdhOpenQuery before PdhAddCounter
Your program calls PdhAddCounterA, therefore it must not be compiled for Unicode