BOOL AFXAPI AfxOleRegisterServerClass( REFCLSID clsid, LPCTSTR lpszClassName, LPCTSTR lpszShortTypeName, LPCTSTR lpszLongTypeName, OLE_APPTYPE nAppType = OAT_SERVER, LPCTSTR* rglpszRegister = NULL, LPCTSTR* rglpszOverwrite = NULL );
#include <afxdisp.h>
Return Value
Nonzero if the server class is successfully registered; otherwise 0.
Parameters
clsid
Reference to the server’s OLE class ID.
lpszClassName
Pointer to a string containing the class name of the server’s objects.
lpszShortTypeName
Pointer to a string containing the short name of the server’s object type, such as “Chart.”
lpszLongTypeName
Pointer to a string containing the long name of the server’s object type, such as “Microsoft Excel 5.0 Chart.”
nAppType
A value, taken from the OLE_APPTYPE enumeration, specifying the type of OLE application. Possible values are the following:
rglpszRegister
Array of pointers to strings representing the keys and values to be added to the OLE system registry if no existing values for the keys are found.
rglpszOverwrite
Array of pointers to strings representing the keys and values to be added to the OLE system registry if the registry contains existing values for the given keys.
Remarks
This function allows you to register your server in the OLE system registry. Most applications can use COleTemplateServer::Register to register the application’s document types. If your application’s system-registry format does not fit the typical pattern, you can use AfxOleRegisterServerClass for more control.
The registry consists of a set of keys and values. The rglpszRegister and rglpszOverwrite arguments are arrays of pointers to strings, each consisting of a key and a value separated by a NULL character ('\0'
). Each of these strings can have replaceable parameters whose places are marked by the character sequences %1
through %5
.
The symbols are filled in as follows:
Symbol | Value |
%1 | Class ID, formatted as a string |
%2 | Class name |
%3 | Path to executable file |
%4 | Short type name |
%5 | Long type name |
See Also COleTemplateServer::UpdateRegistry