Object Dictionary

Created:12/13/2000
Description:

This sample illustrate the creation of a dictionary object that can store anytype of COM object. To retrieve objects from the collection their index or key value can be specified. The __NewEnum property is used to support the for each construct in VB, notice the DISPID of -4. When adding an element into the collection a unique key must be specified.

How to use:
  1. Register the ObjDict.dll
  2. Add a reference to the ObjDict Library in your VB project.
  3. Create an instance of the ObjectDictionary class and using the methods and properties exposed add elements to the dictionary, and then use the various techniques to access these elements.

Application:


Difficulty: Intermediate


Visual C++
File Description
resource.h Resource file.
StdAfx.cpp Source file that includes just the standard includes.
StdAfx.h Header file that includes standard system include files.
ObjectDictionary.cpp Implementation file for CommandLine COM object.
ObjectDictionary.h Header file for CommandLine COM object
ObjectDictionary.rgs Registry script file for CommandLine COM Class.
ObjDict.cpp Implementation of DLL Exports.
ObjDict.def Module Definition file, listing exported functions.
ObjDict.dsp Project file.
ObjDict.dsw Workspace file.
ObjDict.idl The IDL file for the sample.
ObjDict.rc Resource file.
ObjDict.mak Make file for Project.
ObjDictps.def Module definition file for proxy-stub Code.
ObjDictps.mk Make file for proxy-stub code.
ObjDict.dll Compiled DLL for project.