Ben Voigt [C++ MVP] wrote:
Quote:
"Carl Daniel [VC++ MVP]"
<cpdaniel_remove_this_and_nospam@mvps.org.nospamwr ote in message
news:%230txCuzxHHA.4300@TK2MSFTNGP04.phx.gbl...
Quote:
>Kueishiong Tu wrote:
Quote:
>>Is it possible to add a VB ocx to a .NET VC++ project?
>>If yes, how do I do it?
>>
>I'm assuming that by ".NET VC++ project" you mean that you have a
>managed C++ (or C++/CLI) project. For these project types, use
>tlbimp.exe (from the .NET framework SDK, also included with Visual
>Studio) to generate an interop assembly that exposes the OCX as a
>.NET type. You can also simply #import "path-to-your-ocx" to generate
>native
>wrappers for the OCX, which you can then call from native or managed
>C++, but you won't be able to get a verifiable managed image using
>this approach - if that matters to you.
>
An OCX is a "control", not simply a COM class library, and I don't
think the #import option lets you host it in a Form. Or has someone
found a way to do that?
My understanding is that technically, an OCX is nothing more than a AX
control with embedded TLB, while an AX control is a self-registering COM
object. But you're right, it's very likely that the OCX in question is
probably a GUI control.
No, #import won't let you host it in a form, that's for sure, but I think
that Winforms can host OCX controls already via tlbimp. I could well be
wrong about that - I've never done VB6 developmemnt and don't have any OCXs
lying about to experiment with.
-cd