OWLNext 7.0
Borland's Object Windows Library for the modern age
|
A template class, TAutoFactory<> creates callback code for ObjectWindows classes. More...
#include <ocf/olefacto.h>
Public Member Functions | |
operator TComponentFactory () | |
Converts the object into a pointer to the factory. | |
Static Public Member Functions | |
static T * | CreateApp (owl::uint32 options) |
Called when the app is not found and needs to be created. | |
static void | DestroyApp (T *app) |
Destroys the previously created application referred to in app. | |
static IUnknown * | Create (IUnknown *outer, owl::uint32 options, owl::uint32 id) |
Create is a TComponentFactory callback function that creates or destroys the application or creates objects. | |
A template class, TAutoFactory<> creates callback code for ObjectWindows classes.
The application class is passed as the argument to the template. By itself, TAutoFactory<> does not provide linking or embedding support for ObjectWindows automated applications.
Although TAutoFactory<> simplifies the process of creating the callback function, you can write your own callback function or provide alternate implementation for any or all of TAutoFactory<>'s functions.
Definition at line 362 of file olefacto.h.
|
static |
Create is a TComponentFactory callback function that creates or destroys the application or creates objects.
If an application object does not already exist, Create creates a new one. The outer argument points to the OLE 2 IUnknown interface with which this object aggregates itself. If outer is 0, the new object is not aggregated, or it will become the main object. The options argument indicates the application's mode while it is running. The values for options are either set from the command line or set by ObjectComponents. They are passed in by the "Registrar" to this callback. The application looks at these flags to know how to operate, and the factory callback looks at them to know what to do. For example, a value of amExeMode indicates that the server is running as an .EXE either because it was built as an .EXE or because it is a .DLL that was launched by an .EXE stub and is now running as an executable program. See TOcAppMode enum for a description of the possible values for the options argument. If the application already exists, Create returns the application's OLE interface and registers the options from TOcAppMode enum which contains OLE-related flags used in the application's command line. For example, the amAutomation flag tells the server to register itself as a single-user application. (In general, these flags tell the application whether it has been run as a server, whether it needs to register itself, and so on.) The id argument, which is not used for TAutoFactory, is always 0.
Definition at line 440 of file olefacto.h.
References ocf::amRun, ocf::amServedApp, ocf::amShutdown, CHECK, owl::TAppDictionary::GetApplication(), owl::OWLGetAppDictionary(), Registrar, and TYPESAFE_DOWNCAST.
|
static |
Called when the app is not found and needs to be created.
CreateApp creates a new automated application. By default, it creates a new application of template type T with no arguments. The options argument is one of the TOcAppMode enum values, for example, amRun, amAutomation, and so on that indicate the application's mode when running.
Definition at line 396 of file olefacto.h.
References ocf::amEmbedding, and ocf::amExeMode.
|
static |
Destroys the previously created application referred to in app.
Definition at line 409 of file olefacto.h.
|
inline |
Converts the object into a pointer to the factory.
ObjectComponents uses this pointer to create the automated object.
Definition at line 366 of file olefacto.h.
References ocf::TAutoFactory< T >::Create().