From: Stuart on
Recently I have been attempting to get memory information (Committed
Bytes, Commit Limit) using the Pdh calls (PdhOpenQuery,
PdhMakeCounterPath, PdhCollectQueryData, PdhGetFormattedCounterValue).
In the MSDN there is what appears to be a good example of a program
using the Pdh interface to acquire the memory Cache Bytes, memory
Available Bytes and processor total processor time. The example is at
http://support.microsoft.com/default.aspx?scid=kb;en-us;287158 I
found, however, that this program does not work correcty (at least not
under W2k, SP4). After I compile (with a couple of minor lint tweeks)
and run I do not get the expected output:

Adding [Memory\Cache Bytes]
Adding [Memory\Available Bytes]
Adding [Processor\% Processor Time\_Total]
Memory\Cache Bytes : [0.000]
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total : [0.000]
PGFCU failed c0000bbc
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total : [0.000]
PGFCU failed c0000bbc
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total : [0.000]
PGFCU failed c0000bbc
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total : [0.000]
PGFCU failed c0000bbc
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total : [0.000]
PGFCU failed c0000bbc
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total : [-1.#QO]
PGFCU failed c0000bbc
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total : [0.000]
PGFCU failed c0000bbc
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total : [0.000]
PGFCU failed c0000bbc
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total : [-1.#QO]
PGFCU failed c0000bbc
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total :
[11945310990056291000000000000000000000000000000000000000000000000000000
000000000000000000000000000000000.000]
PGFCU failed c0000bbc
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total : [0.000]
PGFCU failed c0000bbc
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total : [0.000]
PGFCU failed c0000bbc
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total : [0.000]
PGFCU failed c0000bbc
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total : [0.000]
PGFCU failed c0000bbc
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total : [0.000]
PGFCU failed c0000bbc
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total : [0.000]
PGFCU failed c0000bbc
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total : [-1.#QO]
PGFCU failed c0000bbc
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total : [0.000]
PGFCU failed c0000bbc
Memory\Available Bytes : [0.000]
Processor\% Processor Time\_Total : [0.000]

Basically I never get good data and the second time around and after
the attempt to get (format) the cache size fails. I can only assume
that the example USED to work. I have used some other calls in place
of the PdhGetFormattedCounterValue (e.g. the raw counter) but the
results were not useful. I have been unable to figure out, based on
the MSDN, how to proceed. Has anyone used this example as a starting
point for use under W2k and if so what did you have to do to get it to
work?

TIA

anderssd

--
x_stuartanderson(a)bauercontrols.xcom

cut off the x_ and change the .xcom to .com