CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Aug 2009
    Posts
    13

    ActiveX/COM Event Sink problem

    The ActiveX component I am using successfully calls my event sink.

    I get the value:

    LPDISPATCH lpDispQuoteValue = V_DISPATCH(&varlValue);

    I then try to use the MFC Visual Studio wizard generated class (from typelib).

    CQuote quote(lpDispQuoteValue)

    If I let it run through debugger normally I get:

    First-chance exception at 0x02480183 in ... 0xC0000005: Access violation reading location 0x524b3629.

    But, if I step through the code one line at a time it works.

    Any idea why?

    Thanks

  2. #2
    Join Date
    Aug 2009
    Posts
    13

    Re: ActiveX/COM Event Sink problem

    I didn't figure out why it was happening, but this awesome class saved me from my horrible COM nightmare:

    http://www.codeproject.com/KB/COM/co...tchdriver.aspx

    xyDispDriver.Attach(lpDispQuoteValue);

    pVarResult = xyDispDriver.GetProperty(_T("Symbol"));

    pVarResult->bstrVal
    Last edited by CCmdTarget; September 4th, 2009 at 02:51 AM.

  3. #3
    Join Date
    Aug 2009
    Posts
    13

    Re: ActiveX/COM Event Sink problem

    And now I realize the wizard generated classes have their own AttachDispatch().

  4. #4
    Join Date
    Aug 2009
    Posts
    13

    Re: ActiveX/COM Event Sink problem

    Keeping the thread updated in-case someone else has this problem.

    I tried the AttachDispatch() method of the VS wizard generated MFC class, but still get the SEH access violation. I passed LPDISPATCH through the constructor the first time. No surprise it did not work because AttachDispatch() should have the same effect.

    Interestingly, XYDispDriver uses the same method as the VS generated classes. Both use COleDispatchDriver.

    I'm sticking with XYDispDriver. It works great:

    http://www.codeproject.com/KB/COM/co...tchdriver.aspx

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured