Click here to Skip to main content
15,884,099 members
Home / Discussions / COM
   

COM

 
GeneralRe: I'll Try to Explain Clearly Pin
Tim Cook17-Apr-09 5:31
Tim Cook17-Apr-09 5:31 
Questionactivex loading from tomcat 6 Pin
aysl2-Apr-09 5:28
aysl2-Apr-09 5:28 
QuestionTroubles embedding IE8 WebBrowser control Pin
Vlasta_1-Apr-09 5:11
Vlasta_1-Apr-09 5:11 
QuestionUsing COM to receive cell updates from excel in VB .NET Pin
mmiller0391-Apr-09 5:07
mmiller0391-Apr-09 5:07 
Questionhow to get mail address in outlook express Pin
nikhil3131-Mar-09 22:25
nikhil3131-Mar-09 22:25 
QuestionC++ COM EventHandler: How to catch COM events from Delphi COM Server / VC6 Pin
ipforce30-Mar-09 4:57
ipforce30-Mar-09 4:57 
AnswerRe: C++ COM EventHandler: How to catch COM events from Delphi COM Server / VC6 Pin
Jonathan Davies2-Apr-09 5:32
Jonathan Davies2-Apr-09 5:32 
GeneralRe: C++ COM EventHandler: How to catch COM events from Delphi COM Server / VC6 Pin
ipforce2-Apr-09 6:08
ipforce2-Apr-09 6:08 
Hi,

thank you for your quick answer. I've read this article before, and I've implemented a Event Sink in that way, how it was described in Microsofts AtlEvent[^] Example. One another good article I've found in another site Dispinterface vs. Events and Runtime Sinks[^] has brought me on the idea with the special MT CoInitialize flags.

But the reality is, if I follow the steps to create the event handler as shown in the MS or guru example, everything goes o.k. (Connection is built, every function gives S_OK). Server is found, etc., even DispEventAdvise gives S_OK.

- But I didn't receive any event - muahhh Sigh | :sigh: Sigh | :sigh: Sigh | :sigh:

The events are really fired from the source, because some Delphi Demo Client App shows me the events.

So I came onto the idea that DELPI COM is something special. Do you know a method to deep TRACE the COM event handling ?

<br />
1. Create a new class derived from IDispEventImpl. <br />
      class CSinkObj : public IDispEventImpl<IDC_OBJ, CSinkObj><br />
      {<br />
         ...<br />
      }<br />
<br />
2. Specify the source interface ID, ...<br />
<br />
      class CSinkObj : public IDispEventImpl<IDC_OBJ, CSinkObj,<br />
         &DIID__EventSink, // Source interface GUID.<br />
         &LIBID_COMOBJLib, // typelib ID containing source interface.<br />
         1,                // Major version # of LIBID_COMOBJLib.<br />
         0>                // Minor version # of LIBID_COMOBJLib.<br />
      {<br />
         ...<br />
      }<br />
<br />
3. Add a sink map ... SINK_ENTRY():<br />
<br />
      class CSinkObj : public IDispEventImpl<IDC_OBJ, CSinkObj,<br />
                              &DIID__EventSink, &LIBID_COMOBJLib, 1, 0><br />
      {<br />
      public:<br />
         BEGIN_SINK_MAP(CSinkObj)<br />
            SINK_ENTRY_EX(IDC_SRCOBJ, DIID__EventSink, 1, OnTick)<br />
         END_SINK_MAP()<br />
         ...<br />
      }<br />
<br />
4. Add event handler methods to your class ( __stdcall calling convention):<br />
<br />
      class CSinkObj : public IDispEventImpl<IDC_SRCOBJ, CSinkObj3><br />
      {<br />
      public:<br />
         BEGIN_SINK_MAP(CSinkObj)<br />
            SINK_ENTRY(IDC_SRCOBJ, 1 , OnTick)<br />
         END_SINK_MAP()<br />
<br />
         // event handler for event defined in idl as<br />
         // [id(1)] HRESULT Tick([in] long tckcnt);<br />
         HRESULT __stdcall OnTick(long tickcnt)<br />
         {<br />
            ATLTRACE("CSinkObj::OnTick\n");<br />
            return S_OK;<br />
         }<br />
         ...<br />
      }<br />
<br />
5. Connect the sink to the COM object :<br />
      pSinkObj->DispEventAdvise(pUnk);<br />
<br />
6. Disconnect the sink by calling DispEventUnadvise():<br />
<br />
      pSinkObj->DispEventUnadvise(pUnk);<br />



BR,
Andreas
GeneralRe: C++ COM EventHandler: How to catch COM events from Delphi COM Server / VC6 Pin
ipforce2-Apr-09 6:59
ipforce2-Apr-09 6:59 
QuestionUpdating Resource Pin
sumedh_code30-Mar-09 0:55
sumedh_code30-Mar-09 0:55 
QuestionAccess Denied in VC++ COM Pin
RevathiRamakumar30-Mar-09 0:20
RevathiRamakumar30-Mar-09 0:20 
AnswerRe: Access Denied in VC++ COM Pin
Roger Stoltz30-Mar-09 3:35
Roger Stoltz30-Mar-09 3:35 
GeneralRe: Access Denied in VC++ COM [modified] Pin
RevathiRamakumar30-Mar-09 19:39
RevathiRamakumar30-Mar-09 19:39 
AnswerRe: Access Denied in VC++ COM Pin
Roger Stoltz30-Mar-09 22:17
Roger Stoltz30-Mar-09 22:17 
GeneralRe: Access Denied in VC++ COM Pin
RevathiRamakumar30-Mar-09 22:46
RevathiRamakumar30-Mar-09 22:46 
AnswerRe: Access Denied in VC++ COM Pin
Roger Stoltz30-Mar-09 23:04
Roger Stoltz30-Mar-09 23:04 
GeneralRe: Access Denied in VC++ COM Pin
RevathiRamakumar30-Mar-09 23:10
RevathiRamakumar30-Mar-09 23:10 
AnswerRe: Access Denied in VC++ COM Pin
Roger Stoltz30-Mar-09 23:13
Roger Stoltz30-Mar-09 23:13 
GeneralRe: Access Denied in VC++ COM Pin
RevathiRamakumar30-Mar-09 23:16
RevathiRamakumar30-Mar-09 23:16 
GeneralRe: Access Denied in VC++ COM Pin
RevathiRamakumar30-Mar-09 23:56
RevathiRamakumar30-Mar-09 23:56 
AnswerRe: Access Denied in VC++ COM Pin
Roger Stoltz31-Mar-09 3:17
Roger Stoltz31-Mar-09 3:17 
QuestionRe: Access Denied in VC++ COM Pin
Roger Stoltz31-Mar-09 3:17
Roger Stoltz31-Mar-09 3:17 
AnswerRe: Access Denied in VC++ COM Pin
RevathiRamakumar31-Mar-09 18:32
RevathiRamakumar31-Mar-09 18:32 
GeneralRe: Access Denied in VC++ COM Pin
Roger Stoltz1-Apr-09 6:08
Roger Stoltz1-Apr-09 6:08 
GeneralRe: Access Denied in VC++ COM Pin
RevathiRamakumar1-Apr-09 18:11
RevathiRamakumar1-Apr-09 18:11 

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.