Solved

Converting from VB to C++

Posted on 1998-11-17
11
215 Views
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...
0
Comment
Question by:mark2150
11 Comments
 
LVL 86

Expert Comment

by:jkr
Comment Utility
It definitely IS possible. The main consideration is that things will definitely get more complicated (also tha main drawback)...
0
 
LVL 15

Expert Comment

by:Tommy Hui
Comment Utility
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.
0
 
LVL 12

Author Comment

by:mark2150
Comment Utility
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

0
 
LVL 8

Expert Comment

by:Answers2000
Comment Utility
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


0
 
LVL 12

Author Comment

by:mark2150
Comment Utility
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

0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 

Expert Comment

by:woff
Comment Utility
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!
0
 
LVL 13

Expert Comment

by:Mirkwood
Comment Utility
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.
0
 
LVL 4

Expert Comment

by:pagladasu
Comment Utility
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.
0
 
LVL 12

Author Comment

by:mark2150
Comment Utility
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

0
 
LVL 13

Accepted Solution

by:
Mirkwood earned 100 total points
Comment Utility
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.
0
 
LVL 12

Author Comment

by:mark2150
Comment Utility
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

0

Featured Post

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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…
  Included as part of the C++ Standard Template Library (STL) is a collection of generic containers. Each of these containers serves a different purpose and has different pros and cons. It is often difficult to decide which container to use and …
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 goal of the video will be to teach the user the difference and consequence of passing data by value vs passing data by reference in C++. An example of passing data by value as well as an example of passing data by reference will be be given. Bot…

771 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now