Link to home
Start Free TrialLog in
Avatar of mark2150
mark2150

asked on

Converting from VB to C++

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...
Avatar of jkr
jkr
Flag of Germany image

It definitely IS possible. The main consideration is that things will definitely get more complicated (also tha main drawback)...
Avatar of Tommy Hui
Tommy Hui

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.
Avatar of mark2150

ASKER

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?

M

Automated converter VB - > C++

Homer by CiceroSoft (German company)

    English version of their home page is
    http://www.cicerosoft.com/eindex.htm 

    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:
http://www.beyond.com/AF11804/PKSN101020/prod.htm

Prof edition:
http://www.beyond.com/AF11804/PKSN101017/prod.htm


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.

Thanx!

M

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!
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.
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.
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!

M

ASKER CERTIFIED SOLUTION
Avatar of Mirkwood
Mirkwood

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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.

M