Graphisoft®

API Development KitVersion: 18

Initialize

애드온의 메인 엔트리 포인트입니다.

    GSErrCode  Initialize (
        void
    );

 

리턴 값

NoError
초기화 절차가 성공적으로 완료되었습니다.

 

설명

당신은 이 함수를 당신 코드의 메인 엔트리 포인트로 사용할 수 있습니다. DLL/코드 fragment가 메모리에 로드된 직후 라이브러리에 의해 호출되며, 통신 채널들이 올바르게 설정됩니다.

이것은 당신이 global 변수들과 동적 메모리 블록 등을 초기화할 수 있는 장소입니다.

이 함수에서는 CheckEnvironmentRegisterInterface 루틴에서 등록된 여러 서비스에 대한 콜백 함수들도 설치해야 합니다. 또한 당신은 여기에 알림 핸들러를 설치할 수 있습니다.

Featuring API 10  만약 당신의 애드온이 사용자 인터페이스를 갖고 있고, 컨텍스트에 민감한 도움말 엔진을 사용하고 싶다면(툴팁뿐만 아니라 도움말 앵커도 사용하려면), 이 곳은 애드온의 MDID로 자신의 도움말 엔진 경로를 등록할 수 있는 곳입니다. (예제 코드 안의 DG::RegisterAdditionalHelpLocation를 보십시오)

 

예제

typedef struct {
   double   len;
   Int32     index;
} NType;

GSHandle  **handle;
Int32     nAlloc;
Int32     nElem;


// -----------------------------------------------------------------------------
// 애드온이 메모리에 로드된 후에 호출됨
// -----------------------------------------------------------------------------
GSErrCode    __ACDLL_CALL Initialize (void)

{
    // If the add-on has user interface and wants to use context sensitive help engine
    IO::Location helpLoc;
    ACAPI_GetOwnLocation (&helpLoc);
    DG::RegisterAdditionalHelpLocation (MDID_DeveloperID, MDID_LocalID, helpLoc);

    //
    // global 변수 할당
    //
    nAlloc = 8;
    nElem  = 0;
    handle = (NType **) BMhAll (nAlloc * sizeof (NType));
    if (handle == NULL)
        return APIERR_MEMFULL;

    //
    // 메뉴 핸들러 프로시저 설치하기
    //
    GSErrCode err = ACAPI_Install_MenuHandler (32500, MenuCommandHandler);
    if (err != NoError)
        DBPrintf ("Initialize():: ACAPI_Install_MenuHandler failed\n");

    //
    // 변경 기본 알림 핸들러 프로시저 설치하기
    //
    API_ToolBoxItem toolBoxItem;
    BNZeroMemory (&toolBoxItem, sizeof (API_ToolBoxItem));
    toolBoxItem.typeID = API_ZombieElemID;                // for all types
    err = ACAPI_Notify_CatchChangeDefaults (&toolBoxItem, APIDefaultsChangeHandler);
    if (err == NoError) {
        err = ACAPI_Notify_CatchProjectEvent (APINotify_Close, APIProjectEventHandler);
    }

    return err;
}   // Initialize

 

요구사항

버전: API 4.1 또는 이후
헤더: ACAPinc.h

 

참고사항

필수 함수, FreeData
CheckEnvironment, RegisterInterface
DGRegisterAdditionalHelpLocation
API 함수