Archicad C++ API
About Archicad add-on development using the C++ API.

[SOLVED] Automatically starting add-on(notification handler)

Anonymous
Not applicable
Hi

Is it possible to start add-on automatically?

I want to use some events (APINotify_New, APINotify_Open, APINotify_Close).

I've added

GSErrCode __ACENV_CALL	Initialize (void)
{
...
    GSErrCode err = ACAPI_Notify_CatchProjectEvent (API_AllProjectNotificationMask, NotificationHandler);

...
}
on Initialize and I've added notification handler:

static GSErrCode __ACENV_CALL    NotificationHandler (API_NotifyEventID notifID, Int32 param)
{
    switch (notifID) {
        case APINotify_New:
...
        case APINotify_Open:
...
    }
}
Problem is with Initialize method, it isn't executed automatically after ArchiCAD starts.
If I add menu command handler, Iinitialize method will be executed on user's menu action (first time).

Is it possible to run add-on automatically (start Notification handler) without user action?

Thanks

Lukasz
2 REPLIES 2
Tibor Lorantfy
Graphisoft Alumni
Graphisoft Alumni
Hi Lukasz,
Lukasz wrote:
Problem is with Initialize method, it isn't executed automatically after ArchiCAD starts.

Please check the return type of your CheckEnvironment function!
I think you should return APIAddon_Preload in CheckEnvironment function. That way Initialize method will be executed when ArchiCAD starts.
Using ACAPI_KeepInMemory could be necessary also.

Regards,
Tibor
Anonymous
Not applicable
Great! Thanks Tibor. It is working

Best Regards
Lukasz

Didn't find the answer?

Check other topics in this Forum

Back to Forum

Read the latest accepted solutions!

Accepted Solutions

Start a new conversation!