Windows Control (OCX?) using .NET placed in VB6 project

D

Daniel Wilson

I am replacing an ActiveX OCX that was created in VB6. It is used heavily in
a large VB6 program that I do not have the luxury of upgrading to .NET.

The new control must use a significant amount of code that was written in
C++ .NET for a web service.

In C++ .NET, I have the option of creating an MFC ActiveX Control. That
control loads onto a VB6 form just fine. But when I start including .NET
managed code, I run into compile errors.

I also have the option of creating a Windows Control Library (.NET). But
this doesn't load into the VB6 form, at least in the designer. This link
suggests this approach might work at runtime:
http://p2p.wrox.com/topic.asp?TOPIC_ID=5542

This one sounds like what I want to do is completely impossible.
http://www.dotnet247.com/247reference/msgs/24/122843.aspx

Can my .NET code be used on by VB6 form? Can you point me to some
information on doing so? On writing a wrapper to do so?

Thanks!

dwilson
 
D

Daniel Wilson

http://www.dotnet247.com/247reference/msgs/4/20375.aspx

Long discussions comes to the conclusion that this was SUPPOSED to be
supported, but was cut out. Maybe we'll get it at some point in the
future????

I'm not the only developer who NEEDS to do this ... directly or through some
workaround. I realize MS thought developers would more often need to put
old controls into new projects, but it really DOES go both ways.

For a week now, I've been instantiating a .NET control at runtime from VB6,
but the lousy thing won't show up on the screen. Its Visible property is
true ... but it can't be seen.

Since image display is what I'm working on here, I tried a BitBlt from the
..NET control's Handle to my VB6 PictureBox's hDC. No error, but no luck.

I AM managing to reach over to the .NET control's Image (that I'm exposing)
with a GetPixel call, then paint pixel-by-pixel in VB6. Stinks, but may
work in my case.

dwilson
 
D

Daniel Wilson

For anybody following this ... or digging it up in the future ...

My control is an image-rendering thing. So I have managed to cheat by
running it invisible with an VB6 wrapper OCX that passes all the parameters
through. When it's time to display the image, my wrapper tells the control
to dump the image to a JPEG, then loads it up itself. The cheat is working
well enough to go into production.

I have some other issues ... right now dealing w/ a
WindowsFormsParkingWindow message that pops up w/ an access violation when
the VB6 form hosting my VB6 wrapper OCX hosting the .NET control closes.
I'll let you know if/when I get a good solution.

dwilson
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top