Re: How to determine if compiling a Win32 versus MFC project?

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I think you are missing something.

CommonHeader.h

#ifdef _MFC_VER

#define MFC_IS_ENABLED
....
#endif

project 1 stdafx.h

#include commonheader.h

etc.

You can now use it as:

#ifdef MFC_IS_ENABLED
whatever
#endif


--
Ajay Kalra [MVP - VC++]
ajaykalra@xxxxxxxxx


"Danny Pressley" <DannyPressley@xxxxxxxxxxxxxxxx> wrote in message
news:8A8EA6DA-3950-46E9-A784-01FABD8F96E2@xxxxxxxxxxxxxxxx
Hi Ajay,

Are you referring to what stdafx.h accomplishes for MFC projects, a common
header file for all source files to include? Ok, say I create a new common
header file for all my projects (Win32 and MFC) source files to use named
CommonHeader.h. Inside that header file, I will still need some sort of
predefined preprocessor directive to tell the CommonHeader.h to include
which
set of header files. That is why the second section of my last reply I
mentioned just adding a MFC_ENABLED preprocessor define in all my MFC
projects project settings. Below is what I believe you are referring to as
a
common header file.

========================================
========================================
#ifdef ??? //what would this be
#include "stdafx.h"
...
#else
#include "windows.h"
...
#endif
========================================
========================================

Thanks,
Danny



.



Relevant Pages