Access violation when trying to handle a parameter from an event fired from ActiveX DLL 
Author Message
 Access violation when trying to handle a parameter from an event fired from ActiveX DLL

Hello,

I have an ActiveX dll (made from VB 6 SP 5) that raises events. In this
particular event, it will return an interger value.

In VC++, I have Sink that handles the event. But when I try to access the
parameter. The program gives me an "Access Violation error".

The following are the code:

VC++ :

Quote:
> DISPATCH_MAP

    DISP_FUNCTION_ID(CWebEngineSink, "evtOnDecodeJobListComplete",2,
evtOnDecodeJobListComplete,     VT_EMPTY, VTS_I2)

Quote:
> handling function

void CWebEngineSink::evtOnDecodeJobListComplete(short *iJobCount)
{
  AfxMessageBox(short(*iJobCount));

Quote:
}
> error message

    First-chance exception in COMXP1.exe: 0xC0000005: Access Violation.

VB :

Quote:
> declaring the event

    Public Event evtOnDecodeJobListComplete(iJobCount As Integer)

Quote:
> raising the event

    ' iJobCount is a interger (DIM iJobCount as integer)
    RaiseEvent evtOnDecodeJobListComplete(iJobCount)

Could someone please give me a hint on how to fix it. Also, can anyone tell
me how to get more detail on the cause the error.

Thanks

John



Mon, 01 Dec 2003 06:18:52 GMT  
 Access violation when trying to handle a parameter from an event fired from ActiveX DLL
never mind, found out what the problem is. Boy I feel stupid.

John


Quote:
> Hello,

> I have an ActiveX dll (made from VB 6 SP 5) that raises events. In this
> particular event, it will return an interger value.

> In VC++, I have Sink that handles the event. But when I try to access the
> parameter. The program gives me an "Access Violation error".

> The following are the code:

> VC++ :

> > DISPATCH_MAP

>     DISP_FUNCTION_ID(CWebEngineSink, "evtOnDecodeJobListComplete",2,
> evtOnDecodeJobListComplete,     VT_EMPTY, VTS_I2)

> > handling function

> void CWebEngineSink::evtOnDecodeJobListComplete(short *iJobCount)
> {
>   AfxMessageBox(short(*iJobCount));
> }

> > error message
>     First-chance exception in COMXP1.exe: 0xC0000005: Access Violation.

> VB :

> > declaring the event
>     Public Event evtOnDecodeJobListComplete(iJobCount As Integer)

> > raising the event
>     ' iJobCount is a interger (DIM iJobCount as integer)
>     RaiseEvent evtOnDecodeJobListComplete(iJobCount)

> Could someone please give me a hint on how to fix it. Also, can anyone
tell
> me how to get more detail on the cause the error.

> Thanks

> John



Mon, 01 Dec 2003 09:01:58 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Event handle as private member stops event firing.

2. Acces Violation when Fire Event

3. Trying to Fire an Event

4. Fire event with LPDISPATCH parameter

5. How to handle an event fired from a control that was added dynamically

6. creating a sink in VC to handle events fired by VB Com Object

7. How we handle event fired by a client in DCOM object

8. try { } catch {_com_error &e) } causing access violations.

9. access violation error on double click event

10. Exception handling on access violations?

11. extern FILE Handles and Access Violation

12. How to handle access violation?

 

 
Powered by phpBB® Forum Software