By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,853 Members | 958 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,853 IT Pros & Developers. It's quick & easy.

Reusing VB.NET Form dialogs in VC apps

P: n/a
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.

Apr 17 '06 #1
Share this Question
Share on Google+
6 Replies


P: n/a
>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

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net
<ku*****@gmail.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
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.

Apr 17 '06 #2

P: n/a
<ku*****@gmail.com> schrieb:
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();
///

--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://classicvb.org/petition/>

Apr 17 '06 #3

P: n/a
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...

Apr 18 '06 #4

P: n/a
Yes, thats your only option if your using C

--
( OHM ) - One Handed Man
AKA Terry Burns - http://TrainingOn.net
<ku*****@gmail.com> wrote in message
news:11**********************@v46g2000cwv.googlegr oups.com...
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...

Apr 18 '06 #5

P: n/a
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?

Apr 18 '06 #6

P: n/a
Found an article that answers my question...

http://www.codeproject.com/managedcpp/ijw_unmanaged.asp

Apr 19 '06 #7

This discussion thread is closed

Replies have been disabled for this discussion.