Call this method to create an instance of a performance object, given a name.
HRESULT CreateInstanceByName( DWORD dwObjectId, LPCWSTR szInstanceName, CPerfObject** ppInstance ) throw( ); template <class T> HRESULT CreateInstanceByName( LPCWSTR szInstanceName, T** ppInstance ) throw( );
- The ID used in defining the desired performance object. If the desired performance object was created using nonattributed code, then this will be the object ID used with the DECLARE_PERF_OBJECT or DECLARE_PERF_OBJECT_EX macros. For performance objects defined with attributed code, use the templatized version of CreateInstanceByName.
- A Unicode string indicating the name of the instance to be created.
- The address of a pointer that is to point to the new object. When CPerfMon creates instances of classes derived from CPerfObject, the constructors of the derived classes are not called.
Returns S_OK on success, or an error HRESULT on failure.
Before performance counter values can be set, an instance of the performance object containing the counters must be retrieved. If successful, this function creates an instance of the desired performance object and grants access using the supplied pointer.
Use CreateInstanceByName, rather than CreateInstance, to create instances for which no numeric IDs are known in advance.