Click here to Skip to main content
16,006,749 members
Home / Discussions / COM
   

COM

 
GeneralRe: How to pass a HMenu over COM ? Pin
soptest3-May-02 6:50
soptest3-May-02 6:50 
GeneralConnection Point - Console Client Pin
Anil.S29-Apr-02 0:11
Anil.S29-Apr-02 0:11 
GeneralCOM+ LCE Question Pin
Tom Archer28-Apr-02 21:43
Tom Archer28-Apr-02 21:43 
GeneralRe: COM+ LCE Question Pin
Paul M Watt28-Apr-02 22:16
mentorPaul M Watt28-Apr-02 22:16 
GeneralRe: COM+ LCE Question Pin
Tom Archer29-Apr-02 2:53
Tom Archer29-Apr-02 2:53 
GeneralRe: COM+ LCE Question Pin
Joao Vaz29-Apr-02 3:34
Joao Vaz29-Apr-02 3:34 
GeneralRe: COM+ LCE Question Pin
Tom Archer29-Apr-02 3:52
Tom Archer29-Apr-02 3:52 
GeneralRe: COM+ LCE Question Pin
Joao Vaz29-Apr-02 4:21
Joao Vaz29-Apr-02 4:21 
Okay, I will try to explain better ...

quoting Juval:

For COM+ to implement an event class for you, you have to provide COM+ with the sink interfaces definitions, the event class CLSID, and the interface each event class supports. You provide this information in the form of a type library. The type library has to be embedded as a resource in a DLL. The Component Install Wizard knows how to read the type library from the DLL and detect the CoClass definitions inside.

For every CoClass in the type library, COM+ tries to generate an event class and add it to your application as a component. COM+ synthesizes implementation only to interfaces that are part of the event class CoClass definition in the type library.

For example, to define the event class MyEventClass that supports the sink interface IMySink (shown earlier), your IDL file should look like this:

[
uuid(0A9B9E44-E456-4153-9FC8-5D72234B7C82),
version(1.0),
helpstring("Event Class 1.0 Type Library")
]
library EVENTCLASSLib
{
importlib("stdole32.tlb");
importlib("stdole2.tlb");
importlib("SubApp.tlb");//The subscribers' TLB

[
uuid(5CAF8E95-3FEF-40F1-94C3-3F408240D53B),
helpstring("MyEventClass Class")
]
coclass MyEventClass
{
interface IMySink;
};
};

To avoid repeating the definition of the sink interfaces in both the subscriber application and the event class type library, the event class IDL file should import the sink interface (IMySink) definitions from the type library of the subscribers. This is what the line importlib("SubApp.tlb");was used for in the previous example.

end of quotation ...



You should only put your event class in the dll, do not mix with other coclasses ... because this surely will confuse the com+ install wizard, also you should provide your registration logic, this can be achieve inserting a dummy atl object and assert the methods,because this methods aren't never to be called in the first place.

For instance and taken from Juval book Smile | :)

class CMyEventClass :
public CComObjectRootEx<CComMultiThreadModel> ,
public CComCoClass<CMyEventClass,&CLSID_MyEventClass> ,
public IMySinkInterfaceThatYouWantToImplement
{
public:
CMyEventClass( ){};
DECLARE_REGISTRY_RESOURCEID(IDR_MYEVENTCLASS)
DECLARE_PROTECT_FINAL_CONSTRUCT( )

BEGIN_COM_MAP(CMyEventClass)
COM_INTERFACE_ENTRY(IMySinkInterfaceThatYouWantToImplement)
END_COM_MAP( )

// IMySink
public:
STDMETHOD(OnEvent1)( ){ATLASSERT(0);return E_NOTIMPL;};
STDMETHOD(OnEvent2)( ){ATLASSERT(0);return E_NOTIMPL;};
};

The interface could be a custom or automation and should only have [in] parameters, forget the [in] and [in,out] ...



Hope this clears a tiny bit ????


Cheers,
Joao Vaz
Frustrated TCL programmer,good c++ programmer wannabe
GeneralRe: COM+ LCE Question Pin
Joao Vaz29-Apr-02 4:33
Joao Vaz29-Apr-02 4:33 
GeneralRe: COM+ LCE Question Pin
Tom Archer29-Apr-02 9:32
Tom Archer29-Apr-02 9:32 
GeneralRe: COM+ LCE Question Pin
Joao Vaz29-Apr-02 23:04
Joao Vaz29-Apr-02 23:04 
GeneralRe: COM+ LCE Question Pin
Tom Archer29-Apr-02 3:13
Tom Archer29-Apr-02 3:13 
Questioncan you give some advice Pin
viruslee27-Apr-02 21:58
viruslee27-Apr-02 21:58 
AnswerRe: can you give some advice Pin
Tom Archer27-Apr-02 23:49
Tom Archer27-Apr-02 23:49 
GeneralRe: can you give some advice Pin
viruslee28-Apr-02 3:33
viruslee28-Apr-02 3:33 
AnswerRe: can you give some advice Pin
Michael P Butler28-Apr-02 3:51
Michael P Butler28-Apr-02 3:51 
QuestionIPC through COM? Pin
27-Apr-02 3:54
suss27-Apr-02 3:54 
AnswerRe: IPC through COM? Pin
Paul M Watt28-Apr-02 6:47
mentorPaul M Watt28-Apr-02 6:47 
GeneralActiveX Control: Strange RichEdit related linker errors Pin
Chen Venkataraman26-Apr-02 4:42
Chen Venkataraman26-Apr-02 4:42 
GeneralRe: ActiveX Control: Strange RichEdit related linker errors Pin
Chen Venkataraman26-Apr-02 4:49
Chen Venkataraman26-Apr-02 4:49 
GeneralRe: ActiveX Control: Strange RichEdit related linker errors Pin
Chen Venkataraman26-Apr-02 6:01
Chen Venkataraman26-Apr-02 6:01 
QuestionHow to get rid of pesky || characters? Pin
Tommy Svensson26-Apr-02 0:20
Tommy Svensson26-Apr-02 0:20 
AnswerRe: How to get rid of pesky || characters? Pin
Michael P Butler26-Apr-02 0:34
Michael P Butler26-Apr-02 0:34 
QuestionHow to handle huge strings and cross over calls?? Pin
Tommy Svensson25-Apr-02 23:29
Tommy Svensson25-Apr-02 23:29 
AnswerRe: How to handle huge strings and cross over calls?? Pin
Paul M Watt28-Apr-02 6:49
mentorPaul M Watt28-Apr-02 6:49 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.