Need to find a C++ to Visual Basic Conversion Program...

For all coding issues - MODers and programmers, HTML and more.

Moderators: Jeff250, fliptw

Post Reply
User avatar
SirWinner
DBB Fleet Admiral
DBB Fleet Admiral
Posts: 2700
Joined: Thu Nov 05, 1998 12:01 pm
Location: Oklahoma City, Oklahoma, United States of America
Contact:

Need to find a C++ to Visual Basic Conversion Program...

Post by SirWinner »

Need to convert some C++ code to Visual Basic 6 or VB.Net!

The client application has to be in VB if at all possible!

Anyone have any helpful links?

Please NO discussion on which programming language is better. Each has its' own strengths and weaknesses.

Thanks.

8)
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6459
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Post by fliptw »

Is the client going to maintain the code in VB? i'd just write a library wrapper for the code.

There are every expemsive VB to C++ converters. but no C++ to VB converters - probably because of all the ambiguities that C++ can create with code.

You might have to write some VB yourself.
User avatar
SirWinner
DBB Fleet Admiral
DBB Fleet Admiral
Posts: 2700
Joined: Thu Nov 05, 1998 12:01 pm
Location: Oklahoma City, Oklahoma, United States of America
Contact:

Post by SirWinner »

Let me clarify:

I have to maintain the code.

The application program has code already written in VB that is up and running.

Need to add functionality from some C++ stuff into this application but the way the C++ code is written it is not easily understood.

Don't have the time to rewrite the existing application program in C++.

Sounds like I'll have to hand code the C++ to VB conversion.

Thanks for the feedback.

:cry:
User avatar
fliptw
DBB DemiGod
DBB DemiGod
Posts: 6459
Joined: Sat Oct 24, 1998 2:01 am
Location: Calgary Alberta Canada

Post by fliptw »

Can't you redo the C++ code as a library, and just call that code from VB?
User avatar
Grendel
3d Pro Master
3d Pro Master
Posts: 4390
Joined: Mon Oct 28, 2002 3:01 am
Location: Corvallis OR, USA

Post by Grendel »

Wrap the C++ code into an active X control and use that. I don't think there's such a thing like a C++ -> VB converter..
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy »

Hopefully, the C++ code is just a bunch of functions. If so, just compile the project as a DLL instead of an application. Then you can use the LoadLibrary API to access the DLL from VB, and not have to mess with learning COM objects.

If you wind up having to use COM (ActiveX) to use your C++ code in VB, look up IDispatch in the MSDN docs.
User avatar
SirWinner
DBB Fleet Admiral
DBB Fleet Admiral
Posts: 2700
Joined: Thu Nov 05, 1998 12:01 pm
Location: Oklahoma City, Oklahoma, United States of America
Contact:

Post by SirWinner »

The calls I need to make are to DLL's but the code that makes those calls is in C++ with a lot of excess stuff that is C++ header file related (etc...) to get the programs to run when compiled.

Going to attempt to hand code it from C++ to VB.

Thanks for the input guys.

Did e-mail the company that has the SDK stuff... Their old stuff has VB and C++ example code but all their new stuff is in C++.
- Sounds like Microsoft and the new DirectX samples but this SDK was not done by Microsoft.

Going to see if anything in the OLD stuff will give hints on how to do the conversion!

I'd much rather imbed the code needed into ONE program than to have tons of baby applications in multiple programming languages.

:x
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy »

If the excess stuff is C++ header file related, hopefully you won't *need* it in the VB implementation. If the DLL was written (and compiled) properly, you should be able to use LoadLibrary without a hitch.
User avatar
SirWinner
DBB Fleet Admiral
DBB Fleet Admiral
Posts: 2700
Joined: Thu Nov 05, 1998 12:01 pm
Location: Oklahoma City, Oklahoma, United States of America
Contact:

Post by SirWinner »

Plan B: Turned the project over to an old friend of mine out of my state since he does quite a bit of C programming.

Visual Studio 6 C++ project file had a lot of hidden files to go through. Never did find where it finds the link to the DLL... even though I knew the DLL's name.

8)
User avatar
DCrazy
DBB Alumni
DBB Alumni
Posts: 8826
Joined: Wed Mar 15, 2000 3:01 am
Location: Seattle

Post by DCrazy »

Well, the thing is, if the linker establishes the links at design time, the code doesn't necessarily need to establish a connection to the DLL. Visual C++ can use the TLB (type library) file to determine where the DLL's exports are in the DLL file, and compile against the DLL without needing to call LoadLibrary. This is how VC++ links against the WinAPI; MS ships VC++ with .TLB files for every WinAPI library, and even though the actual code is called at runtime, the link is made at compile time.

You'll find references to .dll files in the Project Settings dialog box, IIRC.
Post Reply