I have programmed in c and c++ for years but I am just introducing
myself to the Windows API and MFC.

I started on MFC with this tutorial

http://www.codersource.net/samples/mfc_tutorial_5.zip

To make a long story short ... I edited a dialog box resource, saved
it, then went through the class wizard to create a new class.
Basically step by step through that web page. It generated
NewDialog.cpp and NewDialog.h, but didn't generate stdafx.h or
script3.h . (The resource is named script3).

I googled on this, stdafx.h and the resource header file are
apparently supposed to be generated by
the class wizard, I wasn't able to find anybody else with the same
problem, does anybody know what might be causing this (a project
setting maybe?) or an alternate way to generate them?

I could probably use a generic stdafx.h like this

http://tinyurl.com/yvpl7o

from reading about it, it looks like it is usually pretty standard,
but script3.h should have some necessary things in it, I don't know
what.

Thanks for any help, sorry for the newbie type questions ...


--
Joe Cosby
http://joecosby.com/
Capt. Dobbs:
Suppose every one thought the same way you do?
Capt. Yossarian:
Then I'd be a damn fool to think any different.

:: Currently listening to No Surprises, 1997, by Radiohead, from "OK Computer"

Re: Class wizard not generating stdafx.h by Zapanaz

Zapanaz
Mon Dec 10 13:13:10 PST 2007


On Mon, 10 Dec 2007 13:03:15 -0800, Zapanaz
<http://joecosby.com/code/mail.pl> wrote:

>
>
>I have programmed in c and c++ for years but I am just introducing
>myself to the Windows API and MFC.

I forgot to mention, I'm using Microsoft Visual C++, version 6.0

>
>I started on MFC with this tutorial
>
>http://www.codersource.net/samples/mfc_tutorial_5.zip
>
>To make a long story short ... I edited a dialog box resource, saved
>it, then went through the class wizard to create a new class.
>Basically step by step through that web page. It generated
>NewDialog.cpp and NewDialog.h, but didn't generate stdafx.h or
>script3.h . (The resource is named script3).
>
>I googled on this, stdafx.h and the resource header file are
>apparently supposed to be generated by
>the class wizard, I wasn't able to find anybody else with the same
>problem, does anybody know what might be causing this (a project
>setting maybe?) or an alternate way to generate them?
>
>I could probably use a generic stdafx.h like this
>
>http://tinyurl.com/yvpl7o
>
>from reading about it, it looks like it is usually pretty standard,
>but script3.h should have some necessary things in it, I don't know
>what.
>
>Thanks for any help, sorry for the newbie type questions ...

--
Joe Cosby
http://joecosby.com/
Well I am not going to get into a 'my ego is more dissolved than yours' match.
with you

:: Currently listening to Ming, 1964, by Cal Tjader, from "Soul Sauce"

Re: Class wizard not generating stdafx.h by Norbert

Norbert
Mon Dec 10 13:44:13 PST 2007

Zapanaz schrieb:

> To make a long story short ... I edited a dialog box resource, saved
> it, then went through the class wizard to create a new class.
> Basically step by step through that web page. It generated
> NewDialog.cpp and NewDialog.h, but didn't generate stdafx.h or
> script3.h . (The resource is named script3).
>
> I googled on this, stdafx.h and the resource header file are
> apparently supposed to be generated by
> the class wizard,

No, that is false. Class wizard has nothing to do with it.
The New Project wizard generates the stdafx.h/stdafx.cpp files when you create a
new MFC project and select support for precompiled headers.

I wasn't able to find anybody else with the same
> problem, does anybody know what might be causing this (a project
> setting maybe?) or an alternate way to generate them?
>
> I could probably use a generic stdafx.h like this
>
> http://tinyurl.com/yvpl7o

You could do so, it usually does not contain magic, although later VS versions
do put more stuff in them (like defining WINVER and _WIN32_WINNT).

You do not really need a stdafx.h file. It just speeds compilation.

And there will not be a script3.h when you create a dialog resource script3. All
resource IDs are added to the resource.h file that you include in the source
files that need it. THe class wizard will create a script3.cpp and script3.h
when you tell it to create the dialog class for this resource.

Norbert

Re: Class wizard not generating stdafx.h by Scott

Scott
Mon Dec 10 19:22:17 PST 2007

"Zapanaz" <http://joecosby.com/code/mail.pl> wrote in message
news:-JOdnf8Fcbr0NMDanZ2dnUVZ_u-unZ2d@zhonka.net...
>
>
> I have programmed in c and c++ for years but I am just introducing
> myself to the Windows API and MFC.
>
> I started on MFC with this tutorial
>
> http://www.codersource.net/samples/mfc_tutorial_5.zip
>
> To make a long story short ... I edited a dialog box resource, saved
> it, then went through the class wizard to create a new class.
> Basically step by step through that web page. It generated
> NewDialog.cpp and NewDialog.h, but didn't generate stdafx.h or
> script3.h . (The resource is named script3).

The project is quite primitive and does not use or need stdafx.h. If you
are getting an error message about stdafx.h then go into the project
settings, find the precompiled header choices, and select 'not using
precompiled header.'

The project settings and file names are pretty standardized in MFC, but that
only happens if you use the File, New application wizard to start the
project. Your tutorial did not do things this way.

If you can find a copy of 'Programming Windows with MFC' by Prosise it will
help you a lot. This oldie but goodie book uses VC6 for all the examples.

--
Scott McPhillips [VC++ MVP]


Re: Class wizard not generating stdafx.h by ajk

ajk
Mon Dec 10 22:50:03 PST 2007

On Mon, 10 Dec 2007 13:03:15 -0800, Zapanaz
<http://joecosby.com/code/mail.pl> wrote:

>
>
>I have programmed in c and c++ for years but I am just introducing
>myself to the Windows API and MFC.
>
>I started on MFC with this tutorial
>
>http://www.codersource.net/samples/mfc_tutorial_5.zip
>
>To make a long story short ... I edited a dialog box resource, saved
>it, then went through the class wizard to create a new class.
>Basically step by step through that web page. It generated
>NewDialog.cpp and NewDialog.h, but didn't generate stdafx.h or
>script3.h . (The resource is named script3).
>
>I googled on this, stdafx.h and the resource header file are
>apparently supposed to be generated by
>the class wizard, I wasn't able to find anybody else with the same
>problem, does anybody know what might be causing this (a project
>setting maybe?) or an alternate way to generate them?
>
>I could probably use a generic stdafx.h like this
>
>http://tinyurl.com/yvpl7o
>
>from reading about it, it looks like it is usually pretty standard,
>but script3.h should have some necessary things in it, I don't know
>what.
>
>Thanks for any help, sorry for the newbie type questions ...

Check what project type you used when did create new project, if you
took the wrong one it may have skipped the stdafx.

If you pick MFC app it should create the stdafx. files

Re: Class wizard not generating stdafx.h by Zapanaz

Zapanaz
Wed Dec 12 15:48:17 PST 2007


On Mon, 10 Dec 2007 13:03:15 -0800, Zapanaz
<http://joecosby.com/code/mail.pl> wrote:

>To make a long story short ... I edited a dialog box resource, saved
>it, then went through the class wizard to create a new class.
>Basically step by step through that web page. It generated
>NewDialog.cpp and NewDialog.h, but didn't generate stdafx.h or
>script3.h . (The resource is named script3).

Thanks all for the help ... as was said, starting out with a Win32
application instead of going through the MFC app wizard caused things
to work strangely.

just on the off chance that somebody else runs into the same thing and
is googling for an answer, this allowed me to work around this

- run the class wizard and generate "myclass"
- in myclass.cpp:
- comment out #include "scriptX.h"
- add #include "resource.h"
- in main.cpp:
- add #include "myclass.h"
- in myclass.h
- add
#include <afxwin.h>
#include "resource.h"

There are probably settings that could be changed to stop it from
acting weird ... I was avoiding the app wizard because I was trying to
start out with a "skeleton" app but I couldn't get it to give me less
than a window, menu and three menu items, which I would then have had
to edit out of the project by hand.



--
Joe Cosby
http://joecosby.com/
Victor Hugo was a madman who thought he was Victor Hugo.
- Jean Cocteau

:: Currently listening to Lullaby, 1989, by The Cure, from "Disintegration"