Microsoft DirectX 8.0 |
Abstract class for implementing Microsoft® DirectShow® objects.
Declaration: Combase.h
This class maintains a static, process-wide count of the number of active objects. The DllCanUnloadNow function uses this count to determine when a DirectShow DLL can be unloaded. Your application can use this count to detect memory leaks caused by undeleted objects.
To implement Component Object Model (COM) objects, use the CUnknown class, which derives from CBaseObject.
Class Methods CBaseObject Constructor method. ~CBaseObject Destructor method. ObjectsActive Retrieves the count of active objects.
Constructor method.
Syntax
CBaseObject( const TCHAR *pName );
Parameters
- pName
- String that contains the name of the object, for debugging purposes.
Remarks
This method increments the active-object count. (See ObjectsActive.)
Allocate the pName parameter in static memory:
// Correct. CBaseObject *pObject = new CBaseObject(NAME("My Object")); // Incorrect. TCHAR ObjectName[] = TEXT("My Object"); CBaseObject *pObject = new CObject(ObjectName);The NAME macro compiles to NULL in retail builds, so that static strings appear only in debug builds. For more information, see DbgDumpObjectRegister.
Destructor method.
Syntax
~CBaseObject(void);
Remarks
This method decrements the active-object count. (See ObjectsActive.)
Retrieves a process-wide count of active objects.
Syntax
static LONG ObjectsActive(void);
Return Value
Returns the number of active objects.