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

MFC App (wizard or from scratch)

10 views
Skip to first unread message

Damjan Vengušt

unread,
Nov 7, 2003, 6:25:56 AM11/7/03
to
Hey !

I would like to ask you, how do you create MFC Apps (Visual C++ 6.0).
Do you use wizard or you start from scratch.

I am interesting in this "scratch thing".

Links, comments,... are appreciated

Thanks,
Damjan

Frank Hickman

unread,
Nov 7, 2003, 7:38:36 AM11/7/03
to
While you can create an MFC app from scratch, the Wizard make it so much
easier to start... Doing it from scratch will make you go bald ;)

--
============
Frank Hickman
NobleSoft, Inc.
============
Replace the _nosp@m_ with @ to reply.


"Damjan Vengušt" <damjan....@guest.arnes.si> wrote in message
news:%hLqb.5269$2B6.1...@news.siol.net...

Joseph M. Newcomer

unread,
Nov 7, 2003, 12:14:40 PM11/7/03
to
I have been programming in MFC since 1995. At no point have I ever found a reason to
"create an application from scratch". I consider this a foolish approach. It serves no
useful purpose, except to prove the person doing it loves to suffer, and loves to waste
time in pointless details.

The wizards handle all the details which are not worth worrying about. With the wizard,
you have a fully-functional framework in less than five minutes and can concentrate on the
real issues of the problem you want to solve. Without the wizard, you waste days trying to
get the framework to work at all, and even then, you probably don't get it all correct.
And changes become difficult. You have to do all the work the wizard does in thiry seconds
by tediously getting everything right yourself. I find it hard to justify wasting time on
such trivia when it is already automated.

All excuses I have seen about why it makes sense seem rather childish "I want to know what
every line of code does", "I want to type in every line myself", "I don't use all those
features and don't want to pay the cost for them" (this is perhaps the most absurd of the
lot; it says that the person creating the program is totally clueless about what is
important). Ultimately, it is one of those childish macho-programmer things that has no
place in modern software construction.
joe

Joseph M. Newcomer [MVP]
email: newc...@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm

Dr. Proctor

unread,
Nov 7, 2003, 3:26:54 PM11/7/03
to
On Fri, 07 Nov 2003 12:25:56 +0100, Damjan Vengušt
<damjan....@guest.arnes.si> wrote:

My entire reason for moving from Win32 API to MFC is that I got bored
of writing same app skeleton code again every time I started writing a
new application (fill in WNDCLASS, RegisterClass, check for errors,
Create main window, check for errors, write WindowProc blah blah...).
Writing everything from scratch each time quickly became a routine I
grew to hate.

MFC/ClassWizard combo takes care of these things and lets you
concentrate on implementing actual functionality for the app.

David Quinn

unread,
Nov 7, 2003, 7:34:17 PM11/7/03
to
Howdy Damjan -- I was just thinking about this exact thing. I'm pretty new
to Windows programming in general so spent a few hours poking around the MFC
wizards results trying to find the WinMain function!! I did find it
eventually and learned a fair bit on the way.
I'm not so much interested in knowing what every line does, I'm more scared
of accidently changing something I don't mean to and the whole thing fall
over, which is why I wanted to know atleast a bit more about the starting
from scratch idea. Things like learning the Message Map syntax so you don't
have to rely purely on the wizard gizmo is what I'm trying to get my head
around.


"Damjan Vengušt" <damjan....@guest.arnes.si> wrote in message
news:%hLqb.5269$2B6.1...@news.siol.net...

Joseph M. Newcomer

unread,
Nov 7, 2003, 9:44:54 PM11/7/03
to
There are a few places where MFC and the Win32 API don't quite mesh well. However,
learning to write from scratch will not address any of these (see, for example, my essays
on my MVP Tips site on the use of Attach/Detach, and UI threads passing the socket handle
of a CAsyncSocket across the boundary).

I wrote my first MFC app in less than two weeks, and it did so much more than I had ever
been able to do "by hand" that I never looked back. Funny thing is, I never missed the
WinMain function, nor have I ever cared about rewriting or overriding the built-in message
loop.

The accidents you incur that cause it to fall over are doing things like putting stuff in
the message map that ClassWizard can't parse, which is actually pretty easy to avoid. Just
keep all your changes outside the magic AFX comments. And the rest of the message map
syntax is dead easy:
ON_SOMETHING( some parameters )
applies everywhere, and most of these take 0-3 parameters, and they are mostly
well-documented, although sometimes (e.g., for the _EX entries) you have to grovel around
a bit to find that documentation.

I favor an incrmental approach to learning: take on faith everything you don't understand,
and concentrate on the things that matter. After a while, you need to know how something
works, then, and only then, spend the time researching it. I didn't even know C++ when I
started; now I can answer a reasonable number of C++ questions as well as MFC questions. I
find this overall a better approach than trying to learn everything-at-once; I've learned
a dozen or more languages this way, and I'm applying the same methodology to C# these
days. I will undoubtedly look back with deep embarrassment on my current C# code, but it
is still not bad as these things go. But a C# expert could probably see (as I probably
will in a year or two) a dozen easier ways to do something I've done. But this has not
stopped me from delivering a couple serious C# apps that customers can use, and one of my
own that I used as my learning testbed.

When learning MFC, single-stepping through the MFC code a lot at first will give you
insights into what it is doing; after a while, you don't bother with this. Knowing where
WinMain is gives little help, although it satisfies idle curiousity (if you never heard of
WinMain, you won't miss it).

Human beings are good mimics. It is a survival trait, and we do it very well. I found that
by imitating paradigms constructed by the wizards, even if I didn't understand them
syntactically, or even semantically, I was able to build an app to prototype level in
about ten days (the first four days were working through the Scribble example and studying
it carefully). By exercising my curiosity incrementally, I got to the point where I can
now be an MVP, but at no time was I overwhelmed by a need to get everything right just so
I could hand-simulate a wizard at all times.
joe

On Sat, 8 Nov 2003 11:04:17 +1030, "David Quinn" <kawi...@hotmail.com.NOSPAMcheers>
wrote:

Joseph M. Newcomer [MVP]

Damjan Vengušt

unread,
Nov 9, 2003, 3:37:18 PM11/9/03
to
Well thanks a lot. I just got an idea (A bad one - as usually :) )

I will forget this scratch idea, and stick to the wizard. I just thought
that it is better start from scratch, because you know exactly what
you are doing (You understand the whole MFC framework,.. ). I guess I
forgot to ask myself: Do I really need to understand the core of MFC
framework, or just the basic things.

However I read some very good facts (in all those replies), why I
shouldn't start from scratch!

Thanks for helping me to clarify this thing.

I am really grateful,

Thanks, Damjan

0 new messages