ATL ActiveX Control with mixed Assembly for use in Visual Basic 6

From: Sunny Beach (spamtrap_at_crayne.org)
Date: 10/18/04


Date: Mon, 18 Oct 2004 01:50:45 +0000 (UTC)

I am at wits end on this one.

I'm building an ActiveX control using ATL and Visual C++ 6.0. It's a
spread*** control to use in a Visual Basic application.

The control will be updating a lot of data in real time so performance
is an issue. For that reason, I have used the Spread*** custom
control that comes with RadASM (http://radasm.visualassembler.com) as
the core of the spread***. So to summarize: Host application is
Visual Basic, ActiveX control skeleton ATL, and primary functionality
of the control is in x86/Win32 assembly language.

The ATL control superclasses the RadASM control's window, which seems
to work quite well for displaying the spreadsheets.

Generally speaking it looks like this idea will work, except for one
thing I can't seem to iron out:

If I drop the control on a VB6 form, it displays properly, runs
properly when VB6 app is compiled as an EXE.

However, from the VB6 IDE if I run the VB app it displays the form and
the control once. Then if I run a second time I get an access
violation in Visual Basic. I will not get the access violation if
anytime in Visual Basic I open the form to edit in the VB6 IDE (why?)
- for some reason this is important, if the control is visible in edit
mode in the IDE, it will always run properly... it makes no sense.

I checked, and the source code for the RadASM spread*** control is
free to use as I see fit. I'd be happy to email anyone who wants to
see it the VC++ / VB / RadASM source code. You would need Visual
Basic 6.0, VC++ 6.0, and RadASM (or MASM) to run the whole mess.


Quantcast