Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Converting from VB to C++

Posted on 1998-11-17
Medium Priority
Last Modified: 2010-04-01
Is there is a more-or-less automated conversion utility that will take runnable VB5 code and convert it to C++?

We have a farily simple application that was written in VB5 Pro that we want to port to C++. Is this hard/easy/trivial/impossible? What are considerations, drawbacks, etc.

Discussion please...
Question by:mark2150
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
LVL 86

Expert Comment

ID: 1178037
It definitely IS possible. The main consideration is that things will definitely get more complicated (also tha main drawback)...
LVL 15

Expert Comment

by:Tommy Hui
ID: 1178038
It is possible, but you are probably never going to find one. The reason is that there are multiple ways of creating a Windows C++ application and each of them is different depending on which compiler you use. For example, would the code be changed to OWL (BC++), MFC (BC++ or VC++), or VCL (BCB), or even C/SDK?

To be fully generic, the conversion utility would probably choose C/SDK to support all the C++ compilers. Then the generated code will need to have all the code necessary to support ActiveX controls. Not too many people are willing to write that code.

My suggestion is to ask yourself why you need it in C++. Is it because the application is too slow? If so, then I would maintain the UI in VB and have the VB program use DLLs written in C++ for speed. Another possibility would be to use C++ to write COM servers to do the work and have the VB program use that instead.
LVL 12

Author Comment

ID: 1178039
Thanks for the input, but I'm rejecting to keep the question open for discussion. I'll give you the points later if the discussion peters out without any more informative answers.

I'm helping out a friend in her computer class. She has an assignment to use C++ to develop a simple app. I'm not a C programmer, but I said I could easily code it in VB so she could use my stuff as a template.

Then the question arises about what is involved in the conversion? I'm building screens in VB and *hoping* that we can port to VC without a *HUGE* investment in time.

Funny thing is, the assignment is kind of silly. Speed is not an issue. But the way the assignment is phrased is very DOSish (if that makes any sense...) You know, the program spec says "Menu options numbered 1 thru 5". It's a silly little database app with 1 being add a record, 2 being edit, 3 being delete, 4 print and 5 exit. Only thing is that with VB you normally exit with [X] or use a button. The Add/Edit/Delete screens I would normally code as a single screen with some option buttons but the way the problem is phrased precludes this.

Makes me wonder if our colleges aren't prepping people for programming in the 70's instead of the 90's...

Anyway, any other tips on porting from VB to VC? Can we re-use forms and such? Do the event calls change much? how about accessing an Access Database file?


Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.


Expert Comment

ID: 1178040
Automated converter VB - > C++

Homer by CiceroSoft (German company)

    English version of their home page is 

    Can't give you a more exact URL because of the use of frames on their site but should be easy to navigate to it.

    There is a download version you can evaluate for 30 days.

Another idea - presumably you are porting to C++ for portability (?) or perhaps for another reason (?).  if the first reason, Java is also an option...

To convert VB to Java

Instant Basic for Java V1.2 by HALCYON SOFTWARE

The professional edition includes additional database and professional control capabilities including support for DAO and RDO. It will convert existing Visual Basic source code to Java source code</B>…and it comes a pure Java certified Installer to create your installation software for Java software.

Standard Edition:

Prof edition:

LVL 12

Author Comment

ID: 1178041
Ok, last try.

Cicero seems like a good concept, but (gasp) almost $5000 for a college project is wayyyyy out of line. I couldn't find the "30 day eval".

I was hoping someone was going to say something like "Copy the forms & rename them xxx",  "Change all of the xxxx statements into yyyy".

I'll close this tonight and award if there are no other ideas.




Expert Comment

ID: 1178042
VB Forms are totally different from Visual C++ resource scripts. Their both in a text format, but that is where the similarities end.

Copying the forms is the easy bit, how long can it take to draw a couple of forms in C++? The problem is porting the code.

The basis behind the languages is the same, they both use api's and work around a simple messaging system, but to convert from one to the other, is a massive job. If you found a tool for $5,000 I would beleive it!

Good Luck!
LVL 13

Expert Comment

ID: 1178043
VC allows you to import the VB forms. So that is no problem. the code is what you have to do yourself. But most likely you'll find similar events in VB and MFC or ATL.

Expert Comment

ID: 1178044
I guess that instead of trying to develop the app in VB, you may explain the logic to your friend, and if she is good enough in C++, she will be able to develop it.
LVL 12

Author Comment

ID: 1178045
Ok. Mirkwood, thanx for your response. That was the kind of answer I was looking for. Can you explain the import process (is it just click & drag or is there a hook?) in an answer & I'll award the points. Everyone else who responded: I'll post a series of "for xxxx" questions with some points for each of you - Thank you for your time!


LVL 13

Accepted Solution

Mirkwood earned 400 total points
ID: 1178046
I'm not really sure I deserve the points but OK.

Create an MFC or ATL application
In developer studio, choose Insert/resource, click  import and select VBForm in the types. Now insert the form.
When you double click, MFC will create a class. Connect the control to the corresponding controls.
Now you have to find an event that looks like the VB events you are trapping.
LVL 12

Author Comment

ID: 1178047
Although the answer is not a *happy* answer (click HERE & all will fix! {grin}) it is a good answer to what I asked. Thanks to all that posted.



Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Templates For Beginners Or How To Encourage The Compiler To Work For You Introduction This tutorial is targeted at the reader who is, perhaps, familiar with the basics of C++ but would prefer a little slower introduction to the more ad…
Introduction This article is the first in a series of articles about the C/C++ Visual Studio Express debugger.  It provides a quick start guide in using the debugger. Part 2 focuses on additional topics in breakpoints.  Lastly, Part 3 focuses on th…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will be introduced to the technique of using vectors in C++. The video will cover how to define a vector, store values in the vector and retrieve data from the values stored in the vector.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question