Advertisement

VB + VC++?

Started by August 23, 2001 08:14 AM
3 comments, last by Eight 23 years, 5 months ago
Is it possible to write code in Visual Basic and then use it inside a Visual C++ project? e.g. Could you write a model loader in Visual Basic, which loads the vertex data into an area of memory (dynamic size) and then have a Visual C++ class/code access this memory to process the data? I''m assuming you could write some sort of component or DLL, but does anyone have an example or info to point me in the right direction? Thanks, Eight
Just to get you started in the right direction:
Any COM (ActiveX) DLL that you create in VB you can access (through COM) in VC++.

Epolevne
Advertisement
So along those same lines could I write modules in VB and use those in VC++? I was thinking that maybe I could do battle or statistic modules in VB and use those to calc my variables. Is it really practical though?
I had a play with this and in the right circumstances I think it would be incredibly useful.

Passing numerical data from a VB DLL to C++ worked well enough after some initial faffing around. I still haven''t managed to pass string data though.

>Is it really practical though?
I don''t see why not.

E

VB handles strings differently to C++, I think the format is something like

4 bytes - length of string
n bytes - string
1 byte - null

Can''t totally remember

But, easiest is to experiment with passing

ByVal VarPtr(MyString) + x

With different values of x (proably 4 though)

Yeah, VarPtr is a nice command they don''t tell you about btw - returns the pointer to a variable.

Trying is the first step towards failure.
Trying is the first step towards failure.

This topic is closed to new replies.

Advertisement