STDMETHOD(GetAddInInfo)(EdmAddInInfo
* poInfo, IEdmVault5 * poVault, IEdmCmdMgr5 * poCmdMgr)
{
//The AFX_MANAGE_STATE macro is needed for MFC
applications but should not
//be used for applications that are MFC-free.
AFX_MANAGE_STATE(AfxGetStaticModuleState());
if (poInfo == NULL || poCmdMgr == NULL )
return E_POINTER;
//Return some information for the
Administrate Add-ins dialog box
poInfo->mbsAddInName = SysAllocString( L"Menu command
sample" );
poInfo->mbsCompany = SysAllocString( L"SOLIDWORKS Corporation"
);
poInfo->mbsDescription= SysAllocString( L"Adds menu items" );
poInfo->mlAddInVersion = 1;
//SOLIDWORKS Enterprise PDM
5.2 or later is required to
install this add-in
poInfo->mlRequiredVersionMajor = 5;
poInfo->mlRequiredVersionMinor = 2;
//Add a command for each of the buttons
(the command ID numbers 1000 and 1001 are
//arbitrary; SOLIDWORKS Enterprise PDM
does not use them; instead, it only passes them to
your
//implementation of OnCmd so that it knows which command was selected)
poCmdMgr->AddCmd( 1000, bstr_t("First command"),
EdmMenu_Nothing,
bstr_t("This
is the first command"),
bstr_t("First command"), -1, 0 );
poCmdMgr->AddCmd( 1001, bstr_t("Second command"),
EdmMenu_MustHaveSelection,
bstr_t("This
is the second command"),
bstr_t("Second command"), -1, 0 );
return S_OK;
}
The flag
EdmMenuFlags.EdmMenu_MustHaveSelection
indicates that only the second command is available to the user if the user
selects one or more files or folders.