다음을 통해 공유


ON_COMMAND

This macro maps a command message to a member function.

ON_COMMAND(id, memberFxn )

매개 변수

  • id
    명령 ID입니다.

  • memberFxn
    The name of the message-handler function to which the command is mapped.

설명

It indicates which function will handle a command message from a command user-interface object such as a menu item or toolbar button.

When a command-target object receives a Windows WM_COMMAND message with the specified ID, ON_COMMAND will call the member function memberFxn to handle the message.

Use ON_COMMAND to map a single command to a member function. Use ON_COMMAND_RANGE to map a range of command ids to one member function. Only one message-map entry can match a given command id. That is, you can't map a command to more than one handler. For more information and examples, see Message Handling and Mapping Topics.

예제

BEGIN_MESSAGE_MAP(CMFCListViewDoc, CDocument)
   ON_COMMAND(ID_MYCOMMAND, &CMFCListViewDoc::OnMycommand)
END_MESSAGE_MAP()

요구 사항

Header: afxmsg_.h

참고 항목

참조

ON_UPDATE_COMMAND_UI

개념

MFC 매크로 및 전역