Поделиться через


CommandHandler Delegate

Registers callback methods with a command source.

delegate void CommandHandler(
   UINT^ cmdID
);

Параметры

  • cmdID
    The command ID.

Заметки

This delegate registers callback methods with a command source. When you add a delegate to the command source object, the callback method becomes a handler for commands coming from the specified source.

For more information, see How to: Add Command Routing to the Windows Forms Control.

For more information on using Windows Forms, see Using a Windows Form User Control in MFC.

Пример

The following is an example of how to use CommandHandler.

private ICommandSource m_CmdSrc;
public void Initialize (ICommandSource cmdSrc)
{
   m_CmdSrc = cmdSrc;
   // substitue ID of your command (from MFC project's resource.h) for 32771 
   m_CmdSrc.AddCommandHandler(32771, new CommandHandler(singleMenuHandler));
}

Требования

Header: afxwinforms.h (defined in assembly atlmfc\lib\mfcmifc80.dll)

См. также

Основные понятия

How to: Add Command Routing to the Windows Forms Control