We value your input!
Please participate in Archicad 28 Home Screen and Tooltips/Quick Tutorials survey

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

[SOLVED] Handler not called

mdelanno
Newcomer
I've successfully created an addon with the VS wizard. The addon loads itself in ArchiCAD and I see my menu in the Tools main menu. But when I click on my menu item (Sample menu), nothing happens.

Here is my RegisterInterface, Initialize and MenuCommandHandler functions:

GSErrCode	__ACENV_CALL	RegisterInterface (void)
{
	GSErrCode err = ACAPI_Register_Menu (32500, 32520, MenuCode_Tools, MenuFlag_Default);
	if (err != NoError)
		DBPrintf ("ACAddOn1:: RegisterInterface() ACAPI_Register_Menu failed\n");

	return err;
}	

GSErrCode __ACENV_CALL	Initialize (void)
{
	GSErrCode err = ACAPI_Install_MenuHandler (32500, MenuCommandHandler);
	if (err != NoError)
		DBPrintf ("ACAddOn1:: Initialize() ACAPI_Install_MenuHandler failed\n");

	return err;
}

GSErrCode __ACENV_CALL	MenuCommandHandler (const API_MenuParams *menuParams)
{
	DBPrintf ("ACAddOn1::MenuCommandHandler() %d/%d\n", menuParams->menuItemRef.menuResID, menuParams->menuItemRef.itemIndex);
	
	return NoError;
}
My ACAddOn1.grc file:

'STR#' 32500 "Menu strings" {
/* [  1] */		"Sample menu"
}

'STR#' 32520 "Status bar strings" {
/* [  1] */		"Sample"
}
If I put breakpoints in RegisterInterface and Initialize, I see they are well executed and NoError is returned. But my breakpoint in MenuCommandHandler is never hit. And there is no output.

I'm using VS 2010 SP1 & Windows 7 & ArchiCAD 18 (build 3006) in demo mode.
1 REPLY 1
mdelanno
Newcomer
Found it while writing my post. I was using Dev Kit 19 with ArchiCAD 18! On MyArchiCAD, it's the 18 version which is available. After changing path to Dev Kit 18, it's working.