OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
Step 4: Creating registration tables

OLE requires programs to identify themselves by registering unique identifiers and names.

ObjectWindows offers macros that let you build a structure to hold registration information. The structure can then be used when creating the application's instance of TOcRegistrar.

Here are the commands to create a simple container registration structure:

REGISTRATION_FORMAT_BUFFER(100) // create buffer for expanding macros
REGDATA(clsid, "{9B0BBE60-B6BD-101B-B3FF-86C8A0834EDE}")
REGDATA(description, "Scribble Pad Container")
END_REGISTRATION
#define REGISTRATION_FORMAT_BUFFER(n)
Definition registry.h:603
#define REGDATA(var, val)
Definition registry.h:591
#define BEGIN_REGISTRATION(regname)
Definition registry.h:583

The first macro, REGISTRATION_FORMAT_BUFFER, sets the size of a buffer needed temporarily as the macros that are expanded. The REGDATA macro places items in the registration structure, AppReg. Each item in AppReg is a smaller structure that contains a key, such as clsid or progid, and a value assigned to the key. The values you assign are case-sensitive strings. The order of keys within the registration table does not matter.

Insert the registration macros after your declaration of the application dictionary. Since the value of the clsid key must be a unique number identifying your application, it is recommended that you generated a new value using the GUIDGEN.EXE utility. (The ObjectWindows Reference Guide entry for clsid explains other ways to generate an identifer.) Of course, modify the value of the description key to describe your container.

The AppReg structure built in the sample code is an application registration structure. A container may also build one or more document registration structures. Both structures are built alike, but each contains a different set of keys and values. The keys in an application registration structure describe attributes of the application. A document registration structure describes the type of document an application can create. A document's attributes include the data formats that it can exchange with the clipboard, its file extensions, and its document type name. The OWLOCF1 sample application does not create any document registration structures.