To create a new query, call the PdhOpenQuery function. The function returns a handle to the query to be used in other PDH function calls. You can create multiple queries to be used in your program.
After you create a query, call the PdhAddCounter function to add a counter to the query. Call PdhAddCounter for each counter to be added to the query. You can use one of the following methods to determine which counters to use.
You should use the PdhRemoveCounter function to remove a counter from a query.