VB app to C++

Donjo
Donjo used Ask the Experts™
on
Any helpful hints in porting VB app to C++
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®

Commented:
eeh, 'Start allover' or.. 'Good Luck!' ?
I have just begun to transfer functions from a VB dll to a C++ dll.
My advice would be to contimue to use VB to develop the user interface but implement some/many of the functions you want to call in c++
You will need to use declare to make the the functions available in in VB, and Export the undecorated manems from CPP.  I use a .def file in VC to export the symbols

The def file format would be something like
LIBRARY gpext.dll
     
     EXPORTS

     Payment
     NormalDraw
 
Then in the c++ header file you for your dll you would use the following to bridge the exported names to the implementation.

extern "C" double _stdcall Payment(double principal, double interest_rate, int term);
extern "C" double _stdcall NormalDraw(double mean, double stdev);

Two thing I found useful. One is using the SAFEARRAY structure which allows you to pass and  return VB arrays into C++ and second, remember (I didn't) that VB passes pointers (ByRef) by default so if you are passing parameters by values, you need to declare them in VB as ByVal , eg.

Declare Function NormalDraw Lib "gpext.dll" (ByVal Mean As Double, ByVal Stdev As Double) As Double

Hope this helps

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial