OWLNext 7.0
Borland's Object Windows Library for the modern age
|
The registrar object registers and runs the application.
Its constructor receives the application registration structure and a pointer to the list of document registration structures. In a linking and embedding application, the registrar is an object of type TOcRegistrar. Insert the following line after the #include statements in your main .CPP file.
The TPointer template ensures that the Registrar object is destructed when the program ends.
static
, and the pointer type should be TPointer<TRegistrar>
, not TPointer<TOcRegistrar>
. However, note that Registrar must still point to a TOcRegistrar object.Next, in OwlMain allocate a new TOcRegistrar object and initialize the global pointer Registrar. The TOcRegistrar constructor has three required parameters: the application's registration structure, the component's factory callback and the command-line string that invoked that application.
An optional fourth parameter points to the beginning of the document registration list. In a Doc/View application, this parameter defaults to the application's list of document templates. Applications that do not use Doc/View should pass a TRegLink* pointing to the list of document registration structures.
TOleFactory is a template that creates a class with a factory callback function. For a linking and embedding ObjectWindows application that does not use Doc/View, the template is called TOleFactory. The code in the factory template assumes you have defined an application dictionary called AppDictionary and a pointer to TRegistrar called Registrar.
When the registrar is created, it compares the information in the registration tables to the application's entries in the system registration database and updates the database if necessary. The Run method causes the registrar to call the factory callback which, among other things, enters the application's message loop.