G
Guest
Is it possible to add a VB ocx to a .NET VC++ project?
If yes, how do I do it?
If yes, how do I do it?
Kueishiong said:Is it possible to add a VB ocx to a .NET VC++ project?
If yes, how do I do it?
Carl Daniel said: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.
Ben said:"Carl Daniel [VC++ MVP]"
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?