Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

MENTAL

Is Visual Basic C++ with MFC?

This topic is 6921 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

A thought barged it''s way into my head the other day and I think you might know what it is - Visual Basic has (almost) the same structure as MFC applications. The MDI windows are identical, and the MFC SDI being banished. The dialogue controls look similar. Hell, the form it''s self has roughly the same properties as MFC. And then we come on to the common dialogue controls 1, 2, and 3. Rebar - CRebar? Treeview - CTreeView? Fileview? Does this sound familiar? There''s even the bloody calender controls in VB and MFC! I personally think that this is all a conspirisy by Microsoft to make the transistion from VB to MFC easier. Shame it didn''t work though. Something sort-of related. VB code could easily be turned into C++ code and then into assembler, thus eliminating the myth that VB is an interpreted language. The "OnKeyPress" events and similar could be used to form the basis of the message map in MFC (and Win32 C++). Now my next point: DirectX. DirectX has been ported to VB. Well, it''s been official ported to VB. VB has always been able to access a some-what cut down version of DirectX just by including the appropriate library files. But now it''s been fully included. And guess what - it''s almost identical to the c++ version!! Another thing I like about VB is the Public Delcare keywords, which give you access to the Win32 API, and surprise, surprise, they have the same function calls as those in c++! All the compiler has to do is insert a little referance to "windows.h" or something similar and there you go. So much for Micro$oft spending countless months porting over and wrapping up the Win32 SDK. I wont even bother going into detail about those magical functions that use the CDC and HWND classes - I''ll let you look up that one for yourself. MENTAL PS: this is just my thoughts - not fact (I think)!!

Share this post


Link to post
Share on other sites
Advertisement
What''s your point? I think Microsoft was trying to make the transition from C++ to VB easier because VB is pretty much Windows only (realbasic for mac) and C++ is cross platform. The reason for the calls being similar is because it is easier to port code from C++ to VB. Along with that, Windows does not have a seperate visual basic dll file for each c++ dll file. It just makes more sense to direct link with a dll.

Share this post


Link to post
Share on other sites
VB also uses the same Compiler as VC++. So it would make sense for Microsoft to "design" it to be similar.

Share this post


Link to post
Share on other sites
1) MFC and Visual Basic both use the official names of the Windows controls, like Treeview, Fileview, Scrollbar, Button, etc. VB does not try to be like MFC or vice versa.

2) Everything BASIC is an interpreted language. That''s why you can run it without compiling it. It doesn''t matter how easily you can port the language to a non-interpreted language -- the only thing that matters is how the compiler treats the code. I''ve heard certain versions and editions of Visual Basic allow the language to be truly compiled, without being interpreted (even so-called compiled VB programs interpret themselves with the help of the VB runtime files).

3) Of COURSE the VB version of DirectX is identical to the C++ version. It has to be, to use the same DLLs. Likewise, you can use DirectX in Delphi, and the structure will be exactly the same.

4) On a similar note about DLLs: There''s no language-specific functions in any DLL, or at least not the Win32 DLLs. In fact, Windows wasn''t programmed in C++ or C; it''s programmed in Assembly (possibly with some C modules).

Also, a DLL usually includes a list of externally-linkable functions, so no matter what language you''ll use, the function calls will be the same.

But Public Declare is an easy way to access functions from DLLs. You could program the same thing into C++, but it''s not a standard feature of the language or its libraries.

~CGameProgrammer( );

Share this post


Link to post
Share on other sites
Actually, a good portion of Visual Basic was WRITTEN in Visual C++(all of it maybe) and the reason the API calls are the same is that you are calling a .dll that is used by all vis. stud. languages, and written in C++. Visual Basic is so similiar to C++ because ALL PROGRAMMING languages have the same basic structure, and if you program with multiple languages, the differences become more a matter of speed, support, and IDE quality. BTW, Visual C++ was written in Visual C++ too, as was Visual FoxPro and Visual J++. C is just the prefered language for the majority of programmers do to its flexibility and capabilities. The reason that the calsses are the same is because most developers use multiple platforms, and there is no sense confusing people by calling a control one thing in C++ and another in Visual Basic. The primary (and relly minor when you get down to it) difference between VB and VC++ is that in VB everything is based upon the form, rather than the module, which is the inverse of C++. Also, the .ocx control (ActiveX) was first created for Visual Basic, several years before VC++ used them. Visual Basic is something seperate and unique from VC++, and each has its own merits, but dont ever make the mistake of thinking that Visual Basic is just some sort of large scale wrapper for VC++. - Oh yea, according to MIcrosoft, Windows is about 75% C, and the rest assembly

Edited by - Etnu on May 13, 2000 3:21:50 AM

Share this post


Link to post
Share on other sites
quote:
Original post by Etnu

Visual Basic is so similiar to C++ because ALL PROGRAMMING languages have the same basic structure, and if you program with multiple languages, the differences become more a matter of speed, support, and IDE quality.


Heh. So, you''re not a Lisp, Haskell, or Prolog user then.

Share this post


Link to post
Share on other sites
The reason I say all programming languages are similiar are this:

If you understand the basic concepts of variable based logic, procedural(or object oriented) functions, and virtually any other programmig topic, you can easily understand that topic on any platform.

How long did you spend learning your first programming language(I mean, really LEARNED, not just the basics)Probably at least five or six months. Now after that what did you need to learn? For me, its usually just a language reference and maybe a short programmers guide. The first programming language I learned was Turbo Pascal during the second semester of my freshman year in high school. I spent about 5 months studying it, and still didnt have it all down. I was mor proficient with VB, C++, and the entire visual studio in under one summer. The reasons are obvious to any programmer who has written for multiple platforms. There are, of course, differences (such as OOP vs. Procedural) but the fundamentals remain the same. visual Basic (prior to 7.0) was still a procedural language because it didnt implement Object oriented features, such as polymorphism and inheritence. You could still write the same applications in VB that you could write in C++. Derived languages such as HTML also have their unique attributes, but are still fundamentaly based on the same general concepts. Just because a feature is packaged one way does not make it completely different, but it does make it easier to work with/harder to work with/faster/etc.. Not to say that programming languages arent different, because if your only considering Sytax, they are very different.

These same concepts are universal. There is more than one way to build a house, just as there is more than one way to build a program. Aside from slight performance differences, and increased programmer frustration, the end product is likely to be the same no matter how it was created.

Share this post


Link to post
Share on other sites
Ok Etnu, not that you are totally wrong, but I think you missed Kylotan''s point. Your point, about programming lanuages being the same, is only accurate when speaking of a relatively small family of programming languages which grew directly out of the procedural structure of the late 50''s and early 60''s assembly languages, the common languages are: ASM, APL, Fortran, Pascal, C, Modula 2, Smalltalk ,C++, Java, etc ...

These languages (even the object oriented ones) all share the same concept that there are type things in a computer, CODE and DATA. Data is declared and typed, code is oredered and called in an identifiable flow of control. THIS is the idiom in which over 95% of all programmers program. BUT it is not the only idiom. I remember a languages class in college for which I had to write a program in Lisp, Prolog, and Smalltalk. Let me tell you, programming in prolog is NOTHING like a procedural language, it is much more like building a MUD while the players are playing (because you are ADDING rules to the engine from the enviroment, not really coding to a text file, so there is NO order to the rules), it is a lot like typing in BNF grammers. And Lisp, it was also very different, I can''t recall it well enough to do it justice, but let me say that you had to THINK in lisp to work it, and even then it was wierd for weeks.

So there ARE different programming languages, but they just aren''t used very often. The main (and only valid) reason for this is, THEY DO NOT MIRROR THE STRUCTURE OF THE COMPUTER HARDWARE. Since ASM IS the structure of the hardware, its many dirivatives are obviously all very similar to each other, the concepts of memory, pointers, function calls, parameters (a stack), etc, all come from asm. But the designers of other languages have basically built completely DIFFERENT virtual machines on top of the real machine, where the compiler is often doing much more than simple instruction look up, something much more like porting or emulation than compiling. Oh well ... enough on that for now!

Share this post


Link to post
Share on other sites
wooey! I stated a flame war (that was a joke, dont quote me on that)!

If VB and VC++ use the same compiler, then does it mean that I can feed the VB compiler c++ files and it will put them into an EXE? Just curious.

MENTAL

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Mental, where in Kent are you from?
I am from a place in between Gravesend and Dartford.
But I am in Glasgow Uni doing Computer Science.

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!