OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Step 4: 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, your application too must maintain a dictionary of the TApplication objects representing each of its container clients. If your DLL uses the DLL version of ObjectWindows, then your DLL needs its own dictionary and cannot use the one in ObjectWindows.

The DEFINE_APP_DICTIONARY macro provides a simple and unified way to create the application object for any application, whether it is a container or 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, 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.

Note
Name your dictionary object AppDictionary to take advantage of the factory templates such as TOleDocViewFactory.