ATL ActiveX control event GPF in VB

MSVC++ 6.0, ATL
WinNT 4.0

I'm battling a persistant problem i cannot seem to get around. I have built an ActiveX control using ATL. Using the ATL wizard I have added a connection-point to use events. When using the control in VB I have discovered that if I try to do certain things in VB in the event function I get Access violation exception. Typically this happens when I try to manipulate frames and window properties or trying to display a messagebox. It only happens when I run the built .exe, not when I run it in debug thru VB. As it is nearly impossible to do run-time debugging of VB programs (MSVBVM60.DLL = no debug info) I cannot zero in on the exact reason for the GPF. Is this a known problem? Has any one else experienced it? If you need more info as to my program, just ask. My workaround now is to use i timer-control and flags to do the operations that are not possible from the event-callbacks. This is, for apparent reasons, not an ideal sollution.
LVL 4
pellepAsked:
Who is Participating?
 
ZoppoConnect With a Mentor Commented:
Hi pellep,

Maybe you're using multiple threads?

See MSDN article 'PRB: Firing Event in Second Thread Causes IPF or GPF'
ID: Q196026

ZOPPO
0
 
gelbertCommented:
Try adding trace code into your ActiveX dll to see which events were okay and which blew up
0
 
gelbertCommented:
You can use "Unobtrusive COM Tracing" (http://www.develop.com/kbrown/com/samples.htm) utility to wathc what is going on
0
Never miss a deadline with monday.com

The revolutionary project management tool is here!   Plan visually with a single glance and make sure your projects get done.

 
pellepAuthor Commented:
ZOPPO!!! You are a hero. I've battled with this problem for two weeks. Reading the article it all makes sence. Of course multithreading should pose problems with VB. I only assumed the universal marshaller solved that for me. I rewrote my component after the fashion described in the MSDN article and, presto, it worked.
And yes - I am using multiple threads in my component.
0
 
pellepAuthor Commented:
ZOPPO!!! You are a hero. I've battled with this problem for two weeks. Reading the article it all makes sence. Of course multithreading should pose problems with VB. I only assumed the universal marshaller solved that for me. I rewrote my component after the fashion described in the MSDN article and, presto, it worked.
And yes - I am using multiple threads in my component.
0
 
ZoppoCommented:
happy I could help you ...

have a nice day,

ZOPPO
0
All Courses

From novice to tech pro — start learning today.