Code Sample: Writing Demand Loading Keys

The following sample (from the ObjectARX SDK polysamp sample program) illustrates writing demand loading keys for an ObjectARX application that registers groups and commands:

void updateRegistry()
{
// Fill the AppInfo structure with our demand loading details.
    AcadAppInfo appInfo;
    appInfo.setAppName("AsdkPolyCAD"); // Application name
    appInfo.setModuleName(acedGetAppName());// Module path
    appInfo.setAppDesc("AsdkPolyCAD"); // Description
    appInfo.setLoadReason(// Specify when we want these to load
        AcadApp::LoadReasons(
        AcadApp::kOnCommandInvocation |
        AcadApp::kOnLoadRequest));
// Write the appInfo to the registry.
    appInfo.writeToRegistry();
// Write the group name.
    appInfo.writeGroupNameToRegistry("ASDK_POLYGON");
// Write out all our commands (Global,Local).
    appInfo.writeCommandNameToRegistry("ASDK_POLY","POLY");
    appInfo.writeCommandNameToRegistry("ASDK_DRAGPOLY","DRAGPOLY");
    appInfo.writeCommandNameToRegistry("ASDK_POLYEDIT","POLYEDIT");
    appInfo.writeCommandNameToRegistry("ASDK_TRANSACT","TRANSACT");
    appInfo.writeCommandNameToRegistry("ASDK_HILITPOLY","HILITPOLY");
    appInfo.writeCommandNameToRegistry("ASDK_HILITSOLID","HILITSOLID");
    appInfo.writeCommandNameToRegistry("ASDK_CREATEINSERT","CREATEINSERT");
    appInfo.writeCommandNameToRegistry("ASDK_HILITINSERT","HILITINSERT");
}
Note: Object Enablers use an abbreviated version of the ObjectARX registry format. See the Registering Object Enablers for Demand Loading section in “Object Enablers” for more details.