Problem with VC++ OCX in VB6.0
-
I am using the VC 6.0 ocx in VB6.0 In this ocx I am firing the event in thread with long value as parameter. There is only single thread. I am getting the correct value in client(vb) application. It's working fine when I am running it. But when I tried to debug in VB application in event after pressing F8 application suddenly exits. But without threading it's I can debug also. I could not get the problem. When I used try catch around fire event it gives exception as memory could not read. Help me for this.... Thanks in advance.
-
I am using the VC 6.0 ocx in VB6.0 In this ocx I am firing the event in thread with long value as parameter. There is only single thread. I am getting the correct value in client(vb) application. It's working fine when I am running it. But when I tried to debug in VB application in event after pressing F8 application suddenly exits. But without threading it's I can debug also. I could not get the problem. When I used try catch around fire event it gives exception as memory could not read. Help me for this.... Thanks in advance.
chetanjoshi9 wrote:
In this ocx I am firing the event in thread with long value as parameter. There is only single thread. .... But without threading it's I can debug also.
:confused: What does this mean? Are you creating secondary threads inside your ActiveX or not? If you are firing events from a secondary thread, you have to initialize the new apartment with a call to
::CoInitialize()
and marshal the event sink interface to the client from the apartment that created your server to the apartment with your secondary thread. Another solution is to post a message to the thread that created your server and fire the event from there."It's supposed to be hard, otherwise anybody could do it!" - selfquote
"High speed never compensates for wrong direction!" - unknown