Hello everyone. I am looking to see if there is any possible way Visual Basic 6.0 code can run in Visual C++ 2008 Express. Any help would be very appreciated.

Recommended Answers

All 14 Replies

I don't even know how anyone could ask such a question. The answer is of course not. Visual Basic 4-6 made heavy use of COM and COM components. These components are usable from C++, but the components are binary objects - not code.

sorry, i said that totally wrong. basically what im trying to do is put code in the basic that references a .dll file created by the c++ code that has the actual stuff in it. how do you reference the .dll in basic?

Is the C++ created dll just a plain vanella Windows dll, or is it a COM component housed in a dll?

just a Windows dll

VB can access any dll written in C language, but C++ DLLs have to have special handling, such as the DLL either has to use extern "C" to make the DLL exported functions C style functions or the VB program has to know about name mangling, and you will have to do that manually. It depends on how the C++ dll was written and what compiler was used to generate the DLL. There is no standard way for compilers to mangle names.

Here are some threads you should review.

oh, did i specify that i was writing c code in the c++ compiler? sorry. its Visual C++ 2008 Express with C code.

and yeah, maybe i should've started this thread in the basic discussion. my bad.

Yes you can write C code with that compiler, providing you named the file *.c instead of *.cpp. If the file is named *.cpp then the compiler will treat it as C++, not C.

i know. what i'm asking is....how do you create a regular windows .dll instead of an .exe from that compiler?

i know. what i'm asking is....how do you create a regular windows .dll instead of an .exe from that compiler?

From which compiler? VC++ 2010 or VB? You can create DLLs from both of them.

In VC++ just create a DLL project and the IDE will generate all the basic code for you. I'm not sure about VB, probably something similar.

ok, yeah, the dll is created from the C++ compiler and accessed by the VB code, now how do you access it from the VB code? looking for actual code here.

The same way you access any of the Microsoft win32 api functions. This is c++ forum, not vb.

i know i put it in the wrong thread area, but i'm new to vb, and don't know how to do that either.

Then you need to start reading tutorials on how to write VB code. Here is a list of a whole bunch of tutorials.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.