Interface implementieren - CCmdTarget
-
Hallo Leute,
ich habe eine Klasse von CCmdTarget abgeleitet.
Diese soll ein paar Interfaces implementieren.
Ich benutze die in der MFC beschriebene Methode über
BEGIN_INTERFACE_PART
END_INTERFACE_PARTIch habe eine Handvoll Interfaces zu implemetieren welche alle von IDispatch abgeleitet sind.
Dumm ist nur dass ich auch immer die standard IDispatch Funktionen implemetieren muss.
Kann mir vielleicht einer sagen wie das in der MFC anders geht.
-
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vcmfc98/html/_mfcnotes_tn038.asp
To implement a class using MFC's interface maps follow these steps:1. Derive a class either directly or indirectly from CCmdTarget.
2. Use the DECLARE_INTERFACE_MAP function in the derived class definition.
3. For each interface you wish to support, use the BEGIN_INTERFACE_PART and END_INTERFACE_PART macros in the class definition.
4. In the implementation file, use the BEGIN_INTERFACE_MAP and END_INTERFACE_MAP macros to define the class's interface map.
5. For each IID supported, use the INTERFACE_PART macro between the BEGIN_INTERFACE_MAP and END_INTERFACE_MAP macros to map that IID to a specific "part" of your class.
6. Implement each of the nested classes that represent the interfaces you support.
7. Use the METHOD_PROLOGUE macro to access the parent, CCmdTarget-derived object.
8. AddRef, Release, and QueryInterface can delegate to the CCmdTarget implementation of these functions (ExternalAddRef, ExternalRelease, and ExternalQueryInterface).