Solved

Need to convert from VB.NET to C++

Posted on 2008-09-30
3
905 Views
Last Modified: 2013-12-14
I have be given the task to  convert a newly finished Windows app (using VB.NET)  to  C++ because of resource limitation on the target machines which prevent .NET from being loaded.  So the solution that's been made is to use C++ and take advantage of the higher performance and lower resrouce requirement of C++.  SO  I need some advices about the major steps in this process ASAP.

The application involves networking and ActiveDirecctory, yet I have had virtually no experience with either.  I will have the VB.NET source code, but I'm afraid it will have little value because I presume it makes extensive use of the .NET Base Class Library.  And those objects would need to be re-written from scratch or  found in some C++ library, if there are any around these days.

If you were handed this task, what major steps would you take to fulfill this assignment?    I can use MFC is I want, so there may be enough tools there to satisfy my needs, but I do not know for sure.

But please keeep your advice high level for this first pass.  I need to present some ideas at a high level first.

thanks,
newbieweb
0
Comment
Question by:newbieweb
  • 2
3 Comments
 
LVL 11

Accepted Solution

by:
ladarling earned 500 total points
ID: 22608471
I assume that you are an accomplished C++ programmer, and that you have no problem reading VB code. I would start with a full analysis of the present applications scope and functionality. Even though this is a rewrite, you already know that much of the existing app is going to be lost in translation. To begin with, I would:
-Identifying the applications dependencies and references (data sources, SDK's (WebDAV, etc) that can be reused in C++ syntax for the new application).

-Scrubbing the printed VB source code for functions that you can reproduce from known C++ entities (iostream.h, MFC's, etc.) and mark them up as such.
-Take another pass through to document functionality for which you cannot directly identify the C++ analog. This phase is going to give you and the intended users an initial understanding of the time line.
-Write up a development plan or flowchart for the modules of the application that are going to be complete rewrites. This will give you a much more accurate idea of the timeline.
If you can duplicate the logic you encounter in step two for known functionality then that is just translation, and should be quick and painless. The bulk of your work is going to become identifying packages that can help replicate the rest of the functionality, and of course interface design. In this scenario I would imagine that you will lean heavily on MFC, since the .NET languages allow programmers to throw tons of UI widgets into the mix. I would make sure you tell management/end users to expect the more streamlined native GUI, and not let them get hung up on any .Net eyecandy.
My best advice is to treat it like you are porting it, which is actually what is really happening. A work-alike is fine, dont get bogged down with nuances. If you know a similar way or a workaround to a problem that the original app solves, do it the C++ way and drive on.
0
 

Author Comment

by:newbieweb
ID: 22609359
Thanks for  the feedback.  I now have a better understanding of the problem.

There are literally two input fields:

Textbox - username
Department -  drop down (The drop down's populated with LDAP)

User enters username, selects department, then clicks Next.

At that point the program creates a name that's unique on the network:

username-dept1-01 (for example)

then sets the machine name to that new name.  If the person brings another machine on the network, the  program names it:

username-dept1-02

and sets the second machine to that name  That's it!

The guy who wrote the VB.NET said the code's not important and it's probably a total rewrite.

Now that I've scaled  down the  problem, how would you approach it?  It does alsso involve ActiveDirectory.

I've had no experience with ActiveDirectory, LDAP or even writing C++ for networking.  I wonder how difficult  it  might be for me to incorporatet these technologies?

I'd  love to hear your approach to solve this problem.

newbieweb
0
 
LVL 11

Expert Comment

by:ladarling
ID: 22614390
As for the networking aspect of it, dont sweat that. Let COM take care of that for you.
I would instead focus on Active Directory Services Interface (ADSI) first thing. The specific functionality you are after is not terribly difficult to accomplish, but I personally would take the time anyway to fully understand the mechanics of ADSI so that you dont get stuck without knowing where to look for help. Let the customer know that you are going to need so lead time to get up to speed on the technologies involved.
Some good introductory material:
http://msdn.microsoft.com/en-us/library/aa772170(VS.85).aspx
http://technet.microsoft.com/en-us/library/bb742578.aspx
Some C++ Specific Code:
http://www.isocra.com/2005/04/adsi-from-cpp/
If the VB.NET programmer was using System.DirectoryServices then you should be able to get equivalent COM functionality from ADSI.
Once you get a handle on the symantics, check out how other people have done it. Even the VBScript code out there helps to get an understanding of whats possible since its using the same components as what you are after.
For full disclosure's sake, I will tell you that I have never tried to code against AD from C++ either. But, with the glut of information out on the net, I bet its going to be a really shallow learning curve.
And, if you do run into any problems along the way, you have hundreds of experts here just waiting to help out :-)
0

Featured Post

Use Case: Protecting a Hybrid Cloud Infrastructure

Microsoft Azure is rapidly becoming the norm in dynamic IT environments. This document describes the challenges that organizations face when protecting data in a hybrid cloud IT environment and presents a use case to demonstrate how Acronis Backup protects all data.

Question has a verified solution.

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

How to install Selenium IDE and loops for quick automated testing. Get Selenium IDE from http://seleniumhq.org Go to that link and select download selenium in the right hand columnThat will then direct you to their download page.From that page s…
Container Orchestration platforms empower organizations to scale their apps at an exceptional rate. This is the reason numerous innovation-driven companies are moving apps to an appropriated datacenter wide platform that empowers them to scale at a …
The goal of the tutorial is to teach the user how to use functions in C++. The video will cover how to define functions, how to call functions and how to create functions prototypes. Microsoft Visual C++ 2010 Express will be used as a text editor an…
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…

803 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