CheckEnvironment

Defines the behavior of the add-on based on the current running environment.

    API_AddonType  CheckEnvironment (
        API_EnvirParams*     envirParams
    );

 

Parameters

envirParams
[in/out] Contains information on the environment. The add-on should also return a textual description of its purpose.

 

Return Values

NoError
The function has completed with success.

For other common API errors see the API Errors document.

 

Remarks

This is one of the main entry points of add-ons; each add-on should implement this function. It is called when the Add-On Manager is enumerating the add-ons during application startup. After collecting the all the information from the different add-ons, the Add-On Manager performs a dependency check, then calls the RegisterInterface function of the “good” add-ons.

The add-on can check the running environment (server application, main and sub-version), and return whether it can run under the given conditions. For example, you can disable your add-on in the demo version of Archicad; or enable/disable certain commands.

This function is also the place to inform other add-ons about the availability of certain services of your add-on (see ACAPI_Register_SupportedService), and also to tell the server application that your add-on requires services of other add-ons (see ACAPI_Register_RequiredService).

 

Example


// -----------------------------------------------------------------------------
// Dependency definitions
// -----------------------------------------------------------------------------
API_AddonType    __ACDLL_CALL    CheckEnvironment (API_EnvirParams* envir)
{
    //
    // Fill in the necessary information
    //
    RSGetIndString (&envir->addOnInfo.name, 32000, 1, ACAPI_GetOwnResModule ());
    RSGetIndString (&envir->addOnInfo.description, 32000, 2, ACAPI_GetOwnResModule ());

    //
    // Register command services
    //
    GSErrCode err = ACAPI_Register_SupportedService ('ABCD', 4L);
    if (err != NoError)
        return APIAddon_DontRegister;

    return APIAddon_Normal;
}   // CheckEnvironment

 

Requirements

Version: API 4.1 or later
Header: ACAPinc.h

 

See Also

API_EnvirParams,
ACAPI_Register_SupportedService, ACAPI_Register_RequiredService, RegisterInterface, API Functions