How to disable menu in MicroStation CE Update15 using XCommands?

Attached sample code snippet. I am getting command name using Xcommand.

In that, there is SetIsEnabled(bool Enabled) API. 

How to use this. I am facing compilation error in Visual Studio 2017.

void DisableMenu()
{
	 IXCommandCP cmd_ptr = XCommandManager::GetManager().FindXCommandByIconName(L"About");
	 IXCommand* xcmd = (IXCommand*)cmd_ptr;
	 xcmd->SetIsEnabled(FALSE);
}

Error:

error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __cdecl Bentley::ECN::IUICommand::SetIsEnabled(bool)" (__imp_?SetIsEnabled@IUICommand@ECN@Bentley@@QEAAX_N@Z) referenced in function "void __cdecl DisableMenu(void)" (?DisableMenu@@YAXXZ).

Regards,

Rajesh

Parents Reply
  • it cannot be used when MicroStation command should be disabled

    The question is 'How do I disable a menu?', not 'How do I disable a MicroStation command?'

    If the OP really wants to disable a MicroStation command, then he should ignore XCommands and instead monitor MicroStation's input queue.  An input queue monitor enables one to reject a command, whatever its origin.

    I think there is a misunderstanding of the relation / dependency between XCommand and ribbon and also what XCommand is

    You're correct: perhaps the OP could clarify his real requirement?

     
    Regards, Jon Summers
    LA Solutions

Children
No Data