Go Premium for a chance to win a PS4. Enter to Win


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
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?


What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.


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

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.

Question has a verified solution.

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

Written by John Humphreys C++ Threading and the POSIX Library This article will cover the basic information that you need to know in order to make use of the POSIX threading library available for C and C++ on UNIX and most Linux systems.   [s…
Many modern programming languages support the concept of a property -- a class member that combines characteristics of both a data member and a method.  These are sometimes called "smart fields" because you can add logic that is applied automaticall…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
The viewer will be introduced to the member functions push_back and pop_back of the vector class. The video will teach the difference between the two as well as how to use each one along with its functionality.

876 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