So sánh macro và class trong c
Hãy nâng cấp lên Microsoft Edge để tận dụng các tính năng mới nhất, bản cập nhật bảo mật và hỗ trợ kỹ thuật. Show Delegate and interface map macros
Trong bài viết nàyMFC supports these macros for delegate and interface maps: Name Description Begins a delegate map. Begins the definition of the interfaced map. Registers callback methods with a command source. Ends a delegate map. Ends the interface map in the implementation file. Creates an entry in the delegate map. Used between the BEGIN_INTERFACE_MAP macro and the END_INTERFACE_MAP macro for each interface your object will support. Attaches an event handler to a managed control. BEGIN_DELEGATE_MAPBegins a delegate map. Syntax
ParametersCLASS The class in which the managed control is hosted. RemarksThis macro marks the beginning of a list of delegate entries, which compose a delegate map. For an example of how this macro is used, see . RequirementsHeader: msclr\event.h BEGIN_INTERFACE_MAPBegins the definition of the interfaced map when used in the implementation file. Syntax
ParameterstheClass The class in which the interface map is to be defined baseClass The class from which theClass derives from. RemarksFor each interface that is implemented, there is one or more INTERFACE_PART macro invocations. For each aggregate that the class uses, there is one INTERFACE_AGGREGATE macro invocation. For more information on interface maps, see Technical Note 38. RequirementsHeader: afxwin.h CommandHandler DelegateRegisters callback methods with a command source. Syntax
ParameterscmdID The command ID. RemarksThis 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. RequirementsHeader: afxwinforms.h (defined in assembly atlmfc\lib\mfcmifc80.dll) CommandUIHandlerRegisters callback methods with a user interface update command message. Syntax
ParameterscmdID The command ID. cmdUI The command message ID. RemarksThis delegate registers callback methods with a user interface update command message.
1 is similar to except that this delegate is used with user interface object update commands. User interface update commands should be mapped one-to-one with message handler methods. For more information on using Windows Forms, see Using a Windows Form User Control in MFC. RequirementsHeader: afxwinforms.h (defined in assembly atlmfc\lib\mfcmifc80.dll) END_DELEGATE_MAPEnds a delegate map. Syntax
RemarksThis macro marks the end of a list of delegate entries, which compose a delegate map. For an example of how this macro is used, see . RequirementsHeader: msclr\event.h END_INTERFACE_MAPEnds the interface map in the implementation file. Syntax
RemarksFor more information about interface maps, see Technical Note 38. RequirementsHeader: afxwin.h EVENT_DELEGATE_ENTRYCreates an entry in the delegate map. Syntax
ParametersMEMBER The event handler method to be attached to the control. ARG0 The first argument of the managed event handler method, such as
2. ARG1 The second argument of the managed event handler method, such as
3. RemarksEach entry in the delegate map corresponds to a managed event handler delegate created by . ExampleThe following code example shows how to call
5 to attach an
4 event handler to an MFC control
7. For a broader explanation of how this macro works in an MFC application, see How to: Sink Windows Forms Events from Native C++ Classes. |