Reusing VB.NET Form dialogs in VC apps

  • Thread starter Thread starter kun1he2
  • Start date Start date
K

kun1he2

Hmm... reusing VB.NET Form dialogs in other VB.NET projects seems very
straight forward.

However, I'm now trying to reuse these dialogs within an existing
C-based app.

The VB.NET project has already been configured for registration for COM
interop, so next question is how do I get retrieve/invoke the dialog's
interfaces/properties?

I'd think that it involves CoCreateInstance initially... but some
examples would be great... e.g. how to do a ShowDialog for starters?

Hmm... still scouring the web for more info... but any pointers/help
will be most appreciated! Thanks.
 
Hmm... still scouring the web for more info... but any 'pointers'/help

Any 'pointers' must be a C based joke. I have never used it but I know that
there are .NET extensions for C++

;-D
 
Hmm... reusing VB.NET Form dialogs in other VB.NET projects seems very
straight forward.

However, I'm now trying to reuse these dialogs within an existing
C-based app.

The VB.NET project has already been configured for registration for COM
interop, so next question is how do I get retrieve/invoke the dialog's
interfaces/properties?

Is your application a classic C++ application, or MC++, or C++/CLI? If it's
one of the latter two, then using the class should be pretty
straightforward.

\\\
using namespace ClassLibrary1;
....
Form1 ^f = gcnew Form1;
f->Show();
///
 
Actually, it's a C application.

Guess the next step will be to look at calling through to the VB.NET
COM objects via some C++ wrapper code...

Btw, OHM... that was a good one... thank you both for the pointers!
heh...
 
Okay thanks, managed to implement a C++ CLR DLL to wrap around the
VB.NET COM objects, which is dynamically linked in at run-time by the C
application.

Next question... I'm not quite familiar with managed code, so apologies
if it turns out to be a trivial issue...

The C++ DLL is called from the C code multiple times throughout the
application's lifetime. These calls need to store "global" variables
for use in subsequent calls, e.g. "managed Strings" to set up the
VB.NET Forms.

Since "managed" data cannot be declared as global, I'm working around
it for now by marshalling these data into "unmanaged" memory, and then
marshalling back again into "managed" memory for subsequent calls.

I believe there should be a cleaner and more efficient way of doing
this?
 
Back
Top