From: galapogos on
Hi,

I have an MFC app built in VS2005 that has various different resources
depending on preprocessor definitions CHOICE_ONE, CHOICE_TWO, or
CHOICE_THREE.

I've created copies of the relevant resources, and assigned conditions
to each of them. I've also added the definitions to "Project
Properties->Resources->General->Preprocesor definitions".

I need the definitions to be seen by my application code as well,
since there are 3 different code paths depending on the proprocessor
definition, so I put the #defines in a separate file choice.h and
#include in stdafx.h.

I'm unable to find a way of syncing them, i.e. just change it in 1
place and have it propogate throughout the entire solution. If I
change it in choice.h, the resources don't see it, and vice versa.

The only way I've manage to sync it is if I manually insert the
#defines into resource.h. However, every time I use resource editor to
modify a resource, the #define gets overwritten/removed.

Is there an easy way of syncing the 2?

Thanks.
From: galapogos on
On Apr 16, 9:40 pm, Joseph M. Newcomer <newco...(a)flounder.com> wrote:
> And to include that header file, you will want to modify the "preprocessor includes" using
> the IDE.  DO NOT edit your file "by hand" unless you well-and-truly understand what you
> are doing!
>                         joe
>
> On Fri, 16 Apr 2010 10:43:51 +0100, David Lowndes <Dav...(a)example.invalid> wrote:
> >>I've created copies of the relevant resources, and assigned conditions
> >>to each of them. I've also added the definitions to "Project
> >>Properties->Resources->General->Preprocesor definitions".
>
> >>I need the definitions to be seen by my application code as well,
> >>since there are 3 different code paths depending on the proprocessor
> >>definition, so I put the #defines in a separate file choice.h and
> >>#include in stdafx.h.
>
> >You want to eliminate the duplicated definition from the project
> >settings and just include the same header file in your .rc file.
>
> >Dave
>
> Joseph M. Newcomer [MVP]
> email: newco...(a)flounder.com
> Web:http://www.flounder.com
> MVP Tips:http://www.flounder.com/mvp_tips.htm

Hi,

I'm not quite sure I understand. You mean include the choice.h header
file that I put my definitions in the .rc file? When I try to do that,
the #include gets removed every time I make changes to the resources
using resource editor.

Where in the VS2005 IDE can I find preprocessor includes? Do I need to
include choice.h both there and in "Project
>>Properties->Resources->General->Preprocesor definitions"?
From: galapogos on
On Apr 19, 10:00 am, galapogos <gois...(a)gmail.com> wrote:
> On Apr 16, 9:40 pm, Joseph M. Newcomer <newco...(a)flounder.com> wrote:
>
>
>
> > And to include that header file, you will want to modify the "preprocessor includes" using
> > the IDE.  DO NOT edit your file "by hand" unless you well-and-truly understand what you
> > are doing!
> >                         joe
>
> > On Fri, 16 Apr 2010 10:43:51 +0100, David Lowndes <Dav...(a)example.invalid> wrote:
> > >>I've created copies of the relevant resources, and assigned conditions
> > >>to each of them. I've also added the definitions to "Project
> > >>Properties->Resources->General->Preprocesor definitions".
>
> > >>I need the definitions to be seen by my application code as well,
> > >>since there are 3 different code paths depending on the proprocessor
> > >>definition, so I put the #defines in a separate file choice.h and
> > >>#include in stdafx.h.
>
> > >You want to eliminate the duplicated definition from the project
> > >settings and just include the same header file in your .rc file.
>
> > >Dave
>
> > Joseph M. Newcomer [MVP]
> > email: newco...(a)flounder.com
> > Web:http://www.flounder.com
> > MVP Tips:http://www.flounder.com/mvp_tips.htm
>
> Hi,
>
> I'm not quite sure I understand. You mean include the choice.h header
> file that I put my definitions in the .rc file? When I try to do that,
> the #include gets removed every time I make changes to the resources
> using resource editor.
>
> Where in the VS2005 IDE can I find preprocessor includes? Do I need to
> include choice.h both there and in "Project
>
> >>Properties->Resources->General->Preprocesor definitions"?

I found out where to put the #include...in the resource tree view. It
works now. Another thing though...how do I change IDR_MAINFRAME and
AFX_IDS_APP_TITLE based on the #if conditionals? Which resource should
I copy and set a condition to?
From: galapogos on
On Apr 19, 10:00 am, galapogos <gois...(a)gmail.com> wrote:
> On Apr 16, 9:40 pm, Joseph M. Newcomer <newco...(a)flounder.com> wrote:
>
>
>
> > And to include that header file, you will want to modify the "preprocessor includes" using
> > the IDE.  DO NOT edit your file "by hand" unless you well-and-truly understand what you
> > are doing!
> >                         joe
>
> > On Fri, 16 Apr 2010 10:43:51 +0100, David Lowndes <Dav...(a)example.invalid> wrote:
> > >>I've created copies of the relevant resources, and assigned conditions
> > >>to each of them. I've also added the definitions to "Project
> > >>Properties->Resources->General->Preprocesor definitions".
>
> > >>I need the definitions to be seen by my application code as well,
> > >>since there are 3 different code paths depending on the proprocessor
> > >>definition, so I put the #defines in a separate file choice.h and
> > >>#include in stdafx.h.
>
> > >You want to eliminate the duplicated definition from the project
> > >settings and just include the same header file in your .rc file.
>
> > >Dave
>
> > Joseph M. Newcomer [MVP]
> > email: newco...(a)flounder.com
> > Web:http://www.flounder.com
> > MVP Tips:http://www.flounder.com/mvp_tips.htm
>
> Hi,
>
> I'm not quite sure I understand. You mean include the choice.h header
> file that I put my definitions in the .rc file? When I try to do that,
> the #include gets removed every time I make changes to the resources
> using resource editor.
>
> Where in the VS2005 IDE can I find preprocessor includes? Do I need to
> include choice.h both there and in "Project
>
> >>Properties->Resources->General->Preprocesor definitions"?

I found out where to put the #include...in the resource tree view. It
works now. Another thing though...how do I change IDR_MAINFRAME and
AFX_IDS_APP_TITLE based on the #if conditionals? Which resource should
I copy and set a condition to?