Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

What 's the difference between win32 app and MFC

0 views
Skip to first unread message

Tony Johansson

unread,
Oct 22, 2005, 11:50:05 AM10/22/05
to
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


David Wilkinson

unread,
Oct 22, 2005, 12:16:31 PM10/22/05
to
Tony Johansson wrote:

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

Tony Johansson

unread,
Oct 22, 2005, 12:38:00 PM10/22/05
to
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


"David Wilkinson" <no-r...@effisols.com> skrev i meddelandet
news:eQjPyPy1...@TK2MSFTNGP09.phx.gbl...

David Wilkinson

unread,
Oct 22, 2005, 1:01:33 PM10/22/05
to
Tony Johansson wrote:

> 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

Tony Johansson

unread,
Oct 22, 2005, 1:45:18 PM10/22/05
to
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

"David Wilkinson" <no-r...@effisols.com> skrev i meddelandet

news:%2389x8oy...@TK2MSFTNGP09.phx.gbl...

Unknown

unread,
Oct 22, 2005, 2:35:54 PM10/22/05
to
On Sat, 22 Oct 2005 15:50:05 GMT, Tony Johansson wrote:

>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.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

William DePalo [MVP VC++]

unread,
Oct 22, 2005, 6:07:14 PM10/22/05
to
"Tony Johansson" <johansson...@telia.com> wrote in message
news:OUu6f.148850$dP1.5...@newsc.telia.net...

> 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


Carl Daniel [VC++ MVP]

unread,
Oct 23, 2005, 1:58:28 PM10/23/05
to

"Tony Johansson" <johansson...@telia.com> wrote in message
news:Nct6f.148832$dP1.5...@newsc.telia.net...

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


Tom Serface

unread,
Oct 24, 2005, 12:54:19 PM10/24/05
to
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

"Tony Johansson" <johansson...@telia.com> wrote in message
news:Nct6f.148832$dP1.5...@newsc.telia.net...

0 new messages