C++ and VB

Started by
10 comments, last by Last Attacker 20 years, 8 months ago
I heard that it is possible to kind of mix C++ and VB code in .NET . I was wondering if you guys know how to mix C++ and VB since I don''t like MFC and neither the slow performance of VB. It would be cool to do GUI easily with VB and put in the powerfull code of C++. Thanks // Last Attacker \\---=( LA )=---// LA Extreme \\

ICQ Number : 120585863

E-mail:

laextr@icqmail.com
"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog
Advertisement
That''s pretty much what MFC already is --> A mix of C++ (powerful language) and VB (RAD)...
You have always been able to mix code through the use of com objects. Many people write a com object for intensive computations in C++, and then call it from the VB programs. I think what you are talking about is mixed mode. VS.Net will allow you to mix languages together as long as they are all compiled to the CLR. There was supposed to be another way where you can have C++ code that was unmanaged and have VB make direct calls to it. This can be very bad as C++ does not have a garbage collector by default. I have not tried it myself, but some friends that do application development state there is a bug in VS which does not allow this. It is supposed to be fixed in VS.NET.
My name is my sig.
I remember reading that you can compile a dll in c++ and call it''s functions from VB- giving you the computing power of c++ and the easy-to-build features of VB.

Grant Palin
Grant Palin
You can make a DLL, and import functions ect. into VB, but as far as I know they must be in COM objects. And Your not really getting much of a difference from doing it all in Visual C++ for ease of use. Personally I find VB and VC++ are equally easly to implement simple UI stuff.

Pat - Ex nihilo nihilus
quote:Original post by patindahat
You can make a DLL, and import functions ect. into VB, but as far as I know they must be in COM objects.


You can simply declare the functions linking to the ones in the DLL. One little line of code.

quote:That''s pretty much what MFC already is --> A mix of C++ (powerful language) and VB (RAD)...


"Rapid-development" is one of the last words I would use to describe MFC.

Kult House - Fresh Production Media

I think the previous posters missed the mark - they are talking about C++ and VB6. LA asked about .Net. If you use C++ with Managed Extentions (and have VS2k3) you can use the _same_ RAD UI tools (WinForms) that VB.Net uses. VB.Net is a new language that is basic-like, it is not code-compatible with VB6 (what two version of basic are?), though some stuff is the same.

VB.Net is a real OO language - you can not only use objects but also write new ones. Part of the whole .Net idea is that you can easily write object in one language and use them in another -i.e. C++/ME and VB.net.

Formerly, you could use C++ to write a COM object and then it was pretty easy to use it in VB. I wrote a tut on how to do this some time ago, ATL COM tutorial.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara
If you want RAD development for windows programs in C++ similar (but in my opinion better) than VB, you should look into the Borland C++ Builder programs. You can get full versions of earlier versions (such as 5 pro) on magazine coverdisks, else you'll have to pay for the newer ones. Its very useful for quickly making software tools for your own use, however in the version I have you have to find and distribute the VCL DLLs with you software for others without it to work.

Its an option if your willing to pay for the newer ones.

-J

[edited by - jason2jason on August 16, 2003 8:45:44 AM]
Thanks MagMai for catching my point!
I didn''t really like MFC, its (from my opinion) very
complicated and I don''t know whats going on (It''ll take a very good tutorial to explain that to me .

I knew about compiling a C++ dll file and calling that from VB but I was hoping for something in the line of making 2 projects (one C++ and the other VB). I code all the heavy stuff in C++ and call it from VB and create all the objects that comes with the window.

Thanks for everyone''s reply.

If it is possible to do it like the way I hoped it would be, please don''t hesitate to reply.

Thanks again!

God bless!


// Last Attacker \\---=( LA )=---// LA Extreme \\

ICQ Number : 120585863

E-mail:

laextr@icqmail.com
"Take delight in the Lord and He will give you your heart's desires" - Psalm 37:4My Blog
What don''t you use the java/c++ combination through the Java native interface.

I''m using it with VTK ( visualization ToolKit) with a very little lost of cpu. The big advantage is that your cade is cross-platform without changing anything ( if you use ansi c++ and not platform specific function such as GlobalAlloc or API such as directX). Even opengl support this combination

Crazyjul

This topic is closed to new replies.

Advertisement