This project is read-only.

Using the Object Monitor

For this tutorial, please use the Composite Controls Beta Demo file (2003 or 2007).

If you get unexpected errors that crash Access, try decompiling the database.


The Object Monitor is a form which is used to monitor object creation / destruction. It is a floating form that can be updated at any time the object model is running. It returns a list of object that have been created by the Composite Control object model, indicating the name, status (active or terminated), and number of references pointing to it. The object monitor serves development purposes and relies on a global collection of references in the cCompositeControl class to do it's work. This collection, gObjectReferences is managed with a function found throughout the Composite Control classes, regRef(). This feature may be disabled for production-level code.


The Object Monitor is simply a floating form. To use it, execute the Autoexec macro. This will open the Object Monitor form as well as the Startup form. In the case of the Composite Control Beta Demo file, the startup form displays the WebButton demo form. After starting the forms, you may switch to the Object Monitor form freely to use it.

The Object Monitor form features include:

1. Object Listbox - In this listbox is displayed a listing of all objects registered in the gObjectReferences collection of the cCompositeControls class. Accordingly, the name is indicated (usually a combination of the Composite Control class name and the name of the primary control it manages) along with the number of references that currently point to it.
2. Update Button - This button iterates the gObjectReferences collection and populates the listbox. AFter doing so, it runs a cleanup routine, which looks for any terminated objects (preceded by a "X") with only one reference remaning and removes them from the collection. Clicking the Update button in succession will referesh the listbox, eliminating these objects from the list.
3. Shutdown Button - Closes the form and shuts down the object model (the cCompositeControls object instance), destroying all Composite Control objects.
4. OK Button - Closes the form without shutting down the object model.


1. Open the Composite Controls Beta Demo file. Both the Startup form and the Object Monitor form will open.

2. Bring the Object Monitor form to the fron by clicking on it.

3. Click the Update button. The following list should appear:

object monitor screenshot0.jpg

Item layout format

999999 CompositeControlObjectName (999) [999999]
  1. 999999 - A unique ID (typically the memory address of the Composite Control object)
  2. CompositeControlObjectName - The name of the Composite Control Object typically is comprised of the name of the class combined with the name of the primary control it manages.
  3. (999) - Number of active references. An object with only 1 reference really has no references - the lone reference is stored in the gObjectReferences collection.
  4. [999999] - An obsolete tag and will be removed in future releases.

Consider the first and last items in the above screenshot:

7413264 - FormBinders (2) [7413364]

The first item, the FormBinders object, only has two references. The FormBinders object is an instance of the cCompositeControlManager class and the two references are the FormBinders instance in the cCompositeControl class declaration, and the reference saved in the gObjectReferences collection.

209190032 - Form Handler::Startup (85) [2090184]

The second item, the FormHandler::Startup object, is a reference to the cControlChild_Event instanced as the Startup Event for the cControl_EventHandler_Form object. Note that it has 85 references. This is because each of the cControl_WebButton objects attach their own Startup() events to the form event handler's Startup() event.

4. Now, close the Startup Form and click the Update button on the Object Monitor Form. The listbox should look something like this:

object monitor screenshot1.jpg

Note the changes. Primarly, the prefix, _X_ has been added to the names of the objects (apart from the three ccompositeControlManager objects at the top). This prefix indicates that the object itself has been terminated - that any references it holds have been destroyed, along with it's own child objects. Also note that the references for the objects have all dropped to 1. This indicates the objects have been properly dereferenced and are ready to be destroyed (the remaining reference is the reference stored in the gObjectReferences collection.)

5. Cick the Update button one more time. The screen should now look like this:

object monitor screenshot2.jpg

The three objects remaining are the cCompositeControlManager objects instanced at the cCompositeControl level and will not be destroyed until the object model shuts down.

Cllick the Shutdown button to shut down the object model.

Last edited Mar 2, 2011 at 4:30 AM by vba_junkie, version 4


No comments yet.