VBGamer |
|
Best Of Both Worlds (Using VB and C++ together) Pascal "Gherkin" vd Heiden (0 replies, 10 views) (2003-May-16) This is an example which demonstrates the use of both VB and C++ together. Well commented source using API's between a Visual Basic application and a C++ DLL back and forth. This is definitely the solution for VB programmers that know some C++ and want to use that knowledge to speed up their CPU-intensive routines (think of: particles, compression, scripting, etc).
If you just run the program, click the Run button on its dialog to run the examples and see the output in the textbox above. To dive into the code and see how it works, start by opening the VB project and see the code in the Run button's Click event. From there are several calls made that will explain a lot.
I have not shown how to use UDT's, simply because not all UDT's will work. You'll have to experiment with that yourself. One thing is for sure, Strings (both fixed-length and variable-length) will not work in a UDT being passed between C++ and VB.
Please note that passing an Array works the same as passing a String (a string is nothing more than an array of chars in c/c++). You must pass the first item of the array by reference and you can declare it in c++ as a pointer to the array.
|