What 's the difference between win32 app and MFC

T

Tony Johansson

Hello!

I just wonder what the difference is between a native win32-app and MFC.

What I know is that you can use Win32 API in both cases.

I think an MFC application is connected with a GUI which a win32 is not. You
may correct me if I'm wrong on this point.

//Tony
 
D

David Wilkinson

Tony said:
Hello!

I just wonder what the difference is between a native win32-app and MFC.

What I know is that you can use Win32 API in both cases.

I think an MFC application is connected with a GUI which a win32 is not. You
may correct me if I'm wrong on this point.

//Tony

Tony:

A Win32 application can either be a Console Application (no GUI) or a
Windows application (GUI).

A Win32 console application runs in a command window and typically does
not use MFC, because most of MFC is GUI-related. A carefully written
console application will compile and run on other systems (e.g. linux
using the gcc compiler).

A Win32 Windows application can be written entirely in the Win32 API, or
it can use MFC. If you want to see how to write Windows applications
without MFC (and without any wizards) look at the book "Programming
Windows 95" by Charles Petzold.

HTH,

David Wilkinson
 
T

Tony Johansson

Hello!!

You wrote the following
A Win32 Windows application can be written entirely in the Win32 API, or
it can use MFC.

I just wonder is it possible to mix both use win32 API and MFC in a win32
application am I right?
Or do you have to chose either of these two alternatives?


//Tony
 
D

David Wilkinson

Tony said:
Hello!!

You wrote the following
A Win32 Windows application can be written entirely in the Win32 API, or
it can use MFC.

I just wonder is it possible to mix both use win32 API and MFC in a win32
application am I right?
Or do you have to chose either of these two alternatives?

Tony:

If you do not use the wizard to create your project, there is really no
difference between a Win32 project and an MFC project. You just include
the headers you want and write your code. An MFC project creates a
native Win32 executable, just as does a Win32 project written without MFC.

If you generate a "Win32 project" using the wizard, then you have to
write your own WinMain function. If you select "MFC project" then the
WinMain is provided for you.

Although purists might say otherwise, there is really no reason not to
use MFC to write native Win32 applications. It just makes life so much
easier.

David Wilkinson
 
T

Tony Johansson

Hello!

You say the following

Although purists might say otherwise, there is really no reason not to
use MFC to write native Win32 applications. It just makes life so much
easier.

Why is it easier?
Will you have access to the GUI editor when choosing the MFC wizard as well
as in choosing the win32 application?

//Tony
 
B

Bob Moore

I just wonder what the difference is between a native win32-app and MFC.

Frankly, I guess the word here is dependency. If you write your app as
an MFC app, then you become dependent upon the presence of the MFC
DLLs. Dependency isn't that big of a deal : after all, (classic) VB
apps have been dependent upon a honking great DLL for years without
anyone other than download-sensitive shareware folks being that
bothered, and the MFC runtime DLLs are on every windows machine AFAIK
(but not the debug ones).

I haven't written a native Win32 api in years - MFC makes it much
easier, and the downside is so footling as to be meaningless, really.


--
Bob Moore
http://bobmoore.mvps.org/
(this is a non-commercial site and does not accept advertising)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Do not reply via email unless specifically requested to do so.
Unsolicited email is NOT welcome and will go unanswered.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
W

William DePalo [MVP VC++]

Tony Johansson said:
You say the following

Although purists might say otherwise, there is really no reason not to
use MFC to write native Win32 applications. It just makes life so much
easier.

Why is it easier?

Well, like any class library MFC does _stuff_. If you understand what it
does, and if what it does is what you want to do, then there is less code
for you to write.

For example, if your application fits int MFC's "mold" you can get print
preview support for free.

Regards,
Will
 
C

Carl Daniel [VC++ MVP]

Tony Johansson said:
Hello!

I just wonder what the difference is between a native win32-app and MFC.

What I know is that you can use Win32 API in both cases.

I think an MFC application is connected with a GUI which a win32 is not.
You may correct me if I'm wrong on this point.

MFC is a library of C++ classes that give a more object-oriented view of the
Win32 API. Many of the MFC classes are little more than OO wrappers on top
of Win32 (e.g CWnd just wraps all of the window functions from Win32 into a
class, and provides some helper facilities for making it easier to deal with
window messages, etc).

MFC also provides facilities such as a document-view architecture that are
not part of the Win32 API, and other utility code (collection classes,
string class, etc) that you might otherwise write yourself, or get from
elsewhere (e.g the C++ standard library, which didn't exist when MFC was
first created).

-cd
 
T

Tom Serface

Hi Tony,

In addition to what others have said, and perhaps in a different way, MFC
applications are Win32 API applications. The nice thing about C++ in
general (and most OOP languages) is that it allows you to build layers of
abstraction. MFC is a very thin layer on top of the Win API that builds
applications on top of a framework or foundation (thus the name Microsoft
Foundation Classes). As others have said, a lot depends on the type of
program you are writing, but I've done all kinds of programs with MFC
(although to be fair I mostly use it for desktop applications that have
menus and toolbars and dialogs and such).

Tom
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top