Skip to main content
GameDev.net gamedev.net
🔒 Locked

ATL or WTL or MFC or STL

Started by calvinhobbs Jun 22, 2004 at 5:35 PM 17 replies 3.5k views
Original Post
calvinhobbs
calvinhobbs
i'm a newbie .. can any1 plz explain the differecnes between these APIs ?? .. in what situations do we have to use each one of them ..
-calvin
cozman
cozman
STL is part of the C++ standard, it contains things like lists,stacks,resizable arrays (vector), queues, and a number of generic algorithms.

The other 3 are Microsoft specific, although WTL was recently open sourced.

MFC and WTL are both for writing GUI applications, and if I'm not mistaken (which i may very well be) WTL is designed to succeed MFC.

I dont know much about ATL other than this link. Also the WTL site says that the WTL extends ATL.
Fruny
Fruny
STL - "Standard Template Library" - part of the C++ standard library that provide, among other things, containers such as dynamic arrays, linked lists or associative arrays, as well as algorithms for searching, sorting, etc.

MFC - "Microsoft Fundation Classes" - A set of classes designed to help you write Win32 applications. You get classes for windows, controls, etc.

ATL - "Active Template Library" - Another set of classes wrapping Win32 objects for COM programming.

WTL - "Windows Template Library" - Yet another set of classes wrapping Win32 objects. I believe it would be "ATL for MFC".

I'm not a windows guru so, of course, I could be completely wrong on the last 3.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
calvinhobbs
calvinhobbs

so, for building a window-application, what should I use MFC or WTL? .. or is there any other latest development in the VC++.NET environment? ...

-calvin
LordShade
LordShade
ATL - Active Template Library
Easy to use template library for creating COM(Component Object Model) executables or dlls.

WTL - Windows Template Library
Think of this like MFC Lite. A template library for UI that failed to make it into ATL.

MFC - Microsoft Foundation Classes
C++ class wrapper around the Win32 API. MFC also adds alot of nice features like Document/View Architecture, Print Preview, Toolbars and much, much more. You can get a skeletal Windows program up and running quickly and easily.
I use MFC to write tools for editing resources for a game.

STL - Standard Template Library
A template library that contains many common 'objects' and routines for use in any application. Maps, lists, queues, vectors(array) and more are contained in this library. Use it so you do not have to write your own.

Happy programming.

{edit: I must type pretty slow. :) }
Fruny
Fruny
Quote:
Original post by calvinhobbs
so, for building a window-application, what should I use MFC or WTL? .. or is there any other latest development in the VC++.NET environment? ...


It's the same question developers everywhere ask whenever Microsoft releases a new API. Don't worry, both are already obsolete! Remember, MS is currently pushing WinForms (and is already hyping Longhorn's Avalon/XAML).

There's a well-written article on this topic (and more) on Joel on Software.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
Xai
Xai
As a modern windows programmer using C++ there are only 2 things that are unquestionably true:

1. You do not need or want to learn MFC.
2. You do want to learn the STL (for ANY kind of C++ programming).

For creating GUI apps there are a few options depending on your needs / desires:

ATL was (and maybe is) a pretty good choice for getting Windows COM based programs going without a terrible amount of trouble.

I don't know WTL so I can't comment on it.

The .NET framework is better than any other library Microsoft has ever created (by a LOT) - although they didn't really create most of it, SUN and Borland did (with Java and the VCL), the only parts Microsoft invented was making the IL (based on JVM) available to all langauges (think COM on steroids), andwrapping the Win32 API very well for a much better GUI experience than Java.

QT is an absolutely amazing cross platform library for C++, but it costs a decent amount of money to use it only commerial products.
kag1
kag1
ehh if your a newbie just starting, and probably not a pro at C++ yet..I would advise you to use the Win32 API..it uses straight C and is the basis for all the others..Sooo..I would learn that first, and that will also help you learn the others..there are numorous tutorials out there on it too..

good luck
calvinhobbs
calvinhobbs

why doesnt MS have a single API like SUN does and then release new versions based on that API with any new changes ? .. say for example we use Java Swing for GUIs .. but now after reading that "Joel on Software" article (tx Fruny) , MS seems to have a passion (no flame intended) for releasing new(and upgraded?) versions .. so how do we keep the application (or as a matter of fact even ourselves) uptodate ... or am i getting it wrong ?!!??
-calvin
Fruny
Fruny
Quote:
Original post by calvinhobbs
MS seems to have a passion (no flame intended) for releasing new(and upgraded?) versions .. so how do we keep the application (or as a matter of fact even ourselves) uptodate ... or am i getting it wrong ?!!??


Once your application has been written, there is no real reason to try and update it to the 'latest and greatest' API. As for keeping *yourself* up-to-date... well, it's one of the challenges in IT. If you don't keep in touch and make yourself learn new things constantly, your skill set becomes obsolete. Fast. Make sure to negociate for further training the day you discuss your employment contract terms.
"Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it." — Brian W. Kernighan
calvinhobbs
calvinhobbs
tx cozman, fruny, LordShade, Xai, kag1 .. got the picture ..
-calvin
Shannon Barber
Shannon Barber
The WTL is what MFC should have been.

If you're going to start writing GUI apps, use either wxWidgets or Qt (they are cross-platform GUI kits).

Quote:
calvinhobbs
so how do we keep the application (or as a matter of fact even ourselves) uptodate ... or am i getting it wrong ?!!??

Surf or drop anchor; meaning you should either constantly upgrade or never. If you constantly upgrade, you minimize the number of things that break so it's a managable task to address the changes. The other philosophy is to setup a target environment and then lock it down and not change anything, so you don't ever have to fix things for forward compatibility.

Such dramatic changes as .Net do not happen often, with something of that magnitude you keep the old code with the old tools and consider .Net for new work.
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
Kylotan
Kylotan
Quote:
Original post by Xai
The .NET framework is better than any other library Microsoft has ever created (by a LOT) - although they didn't really create most of it, SUN and Borland did (with Java and the VCL), the only parts Microsoft invented was making the IL (based on JVM) available to all langauges (think COM on steroids), andwrapping the Win32 API very well for a much better GUI experience than Java.


Xai, how feasible is this for someone wishing to target 98/ME, etc? I don't know the size of the .NET redistributable, for instance.
Xai
Xai
The .NET redist is 23.6 MB, so it is completely unreasonable to expect users who are going online to your website to grab a 500k - 3MB demo file to also retrieve that (if you are a shareware vendor it WILL reduce your market penitration considerably)

... however if you are shipping via CD, you can include it on the CD just like DirectX, or if you are selling downloads to full games which are 50-200MB in size already, providing a link to the .NET redistributable (or the 117k setup.exe bootstrapper) should be perfectly acceptable.

I believe the .NET framework is FULLY supported on Windows 98SE and higher (it DEFINATELY does not run on pre OSR2 versions of Windows 95 - and I'm not 100% sure about 95 OSR2 and 98 prior to second edition).
pi_equals_3
pi_equals_3
I've used a little WTL, and for me it's been great, but for a beginner, learning plain Win32 is a helpful (although irritating) experience. What I've found about WTL is that it isn't well-documented, but if you google it, there are some helpful sites out there. It really helps to know a little bit of Win32 before diving in though.

[Edited by - pi_equals_3 on June 23, 2004 4:29:24 PM]
Etnu
Etnu
Quote:

The .NET redist is 23.6 MB, so it is completely unreasonable to expect users who are going online to your website to grab a 500k - 3MB demo file to also retrieve that (if you are a shareware vendor it WILL reduce your market penitration considerably)


No, it's really not. .Net is a part of XP SP1, and there are so many applications that require having it, it's just as safe to asssume that it's there as Java or the MFC runtimes are.

Quote:

why doesnt MS have a single API like SUN does and then release new versions based on that API with any new changes ?


Because then you get crap like "LPCSTR" all over the place. Dump the old libraries and make something new, and you've got yourself a fresh start. The old libraries are left alone so that developers that used them before can still use them.

All of that stuff aside, if you're doing GUI development under Windows, you should probably be using a .Net language anyway. GUI Apps just plain don't need the performance of normal C/C++, and it's far, far simpler to do it under .Net.

Yes, you can use .Net with C++ code.
---------------------------Hello, and Welcome to some arbitrary temporal location in the space-time continuum.
Extrarius
Extrarius
The last post was by me, but apparently it doesn't tell you when you're about to make an anonymous post now so I posted w/o logging in.
"Walk not the trodden path, for it has borne it's burden." -John, Flying Monk

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.