OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Step 2: Creating an application dictionary

An application dictionary tracks information for the currently active process.

It is particularly useful for DLLs. When several processes use a DLL concurrently, the DLL must maintain multiple copies of the global, static, and dynamic variables that represent its current state in each process. For example, the DLL version of ObjectWindows maintains a dictionary that allows it to retrieve the TApplication corresponding to the currently active client process. If you convert an executable server to a DLL server, it must also maintain a dictionary of the TApplication objects representing each of its container clients.

The DEFINE_APP_DICTIONARY macro provides a simple and unified way to create the dictionary object for any type of application, whether it is a container, a server, a DLL, or an EXE. Insert this statement with your other static variables:

#define DEFINE_APP_DICTIONARY(AppDictionary)
Convenient macro to define a 'AppDictionary' ref and object as needed for use in component DLLs and E...
Definition appdict.h:93

For any application linked to the static version of the DLL library, the macro simply creates a reference to the application dictionary in ObjectWindows. For DLL servers using the DLL version of ObjectWindows, however, it creates an instance of the TAppDictionary class.

It is important to name your dictionary object AppDictionary to take advantage of the factory templates such as TOleFactory.