Click here to Skip to main content
15,887,434 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Preprocessor directives - resources Pin
Richard MacCutchan28-Mar-11 9:06
mveRichard MacCutchan28-Mar-11 9:06 
GeneralRe: Preprocessor directives - resources Pin
bob1697228-Mar-11 17:02
bob1697228-Mar-11 17:02 
GeneralRe: Preprocessor directives - resources Pin
Richard MacCutchan28-Mar-11 22:26
mveRichard MacCutchan28-Mar-11 22:26 
GeneralRe: Preprocessor directives - resources Pin
Chris Meech28-Mar-11 9:15
Chris Meech28-Mar-11 9:15 
GeneralRe: Preprocessor directives - resources Pin
bob1697228-Mar-11 17:09
bob1697228-Mar-11 17:09 
AnswerRe: Preprocessor directives - resources Pin
cp987628-Mar-11 19:29
cp987628-Mar-11 19:29 
GeneralRe: Preprocessor directives - resources Pin
bob1697229-Mar-11 3:18
bob1697229-Mar-11 3:18 
GeneralRe: Preprocessor directives - resources Pin
cp987629-Mar-11 18:38
cp987629-Mar-11 18:38 
We've been using this since VC6 to have customised menus, dialogs, bitmaps etc in different builds.

I just checked VC6 and it appears that in VC6 you can add a preprocessor condition to any resource item EXCEPT string tables, these seem to only depend on language. We skipped VS2003 so I can't comment on what you can do there, but if there is no Condition field in the Properties window on string tables then I guess it isn't supported yet. Just look at the properties windows for other resources (e.g. menus) and you should see the Condition field.

You should be able to use the same syntax in the .rc file that VS uses for other resources dependent on preprocessor definitions, and use the same in string tables. For example, a menu that is only included when DEFINE1 is defined appears as:

#if defined(APSTUDIO_INVOKED) || defined(DEFINE1)
#if defined(APSTUDIO_INVOKED)
IDR_MENU1$(DEFINE1) MENU DISCARDABLE 
#else
IDR_MENU1 MENU DISCARDABLE 
#endif
BEGIN
    POPUP "Menu1"
    BEGIN
        MENUITEM "Help",                 ID_HELP_X
        ...
        ...
    END
END
#endif


I'm not sure about the APSTUDIO_INVOKED, it seems to use two different mechanisms for the conditional inclusion, one for the IDE and the other for a command line version.

You should be able to create a couple of conditional menus or other resources and check the syntax of the .rc file.

Don't forget that you specify these defines under the Resources settings in the Project settings.
Peter
"Until the invention of the computer, the machine gun was the device that enabled humans to make the most mistakes in the smallest amount of time."

QuestionCan we stop and .exe from anthoer .exe Pin
pandit8428-Mar-11 1:08
pandit8428-Mar-11 1:08 
AnswerRe: Can we stop and .exe from anthoer .exe Pin
Nitheesh George28-Mar-11 2:24
Nitheesh George28-Mar-11 2:24 
GeneralRe: Can we stop an .exe from anthoer .exe Pin
pandit8428-Mar-11 2:30
pandit8428-Mar-11 2:30 
AnswerRe: Can we stop an .exe from anthoer .exe Pin
Rajesh R Subramanian28-Mar-11 2:46
professionalRajesh R Subramanian28-Mar-11 2:46 
GeneralRe: Can we stop an .exe from anthoer .exe Pin
Cedric Moonen28-Mar-11 3:00
Cedric Moonen28-Mar-11 3:00 
GeneralRe: Can we stop an .exe from anthoer .exe Pin
CPallini28-Mar-11 3:12
mveCPallini28-Mar-11 3:12 
GeneralRe: Can we stop an .exe from anthoer .exe Pin
pandit8428-Mar-11 3:29
pandit8428-Mar-11 3:29 
QuestionRe: Can we stop an .exe from anthoer .exe Pin
Rajesh R Subramanian28-Mar-11 3:42
professionalRajesh R Subramanian28-Mar-11 3:42 
GeneralRe: Can we stop an .exe from anthoer .exe Pin
pandit8428-Mar-11 3:50
pandit8428-Mar-11 3:50 
QuestionRe: Can we stop an .exe from anthoer .exe Pin
Rajesh R Subramanian28-Mar-11 3:58
professionalRajesh R Subramanian28-Mar-11 3:58 
AnswerRe: Can we stop an .exe from anthoer .exe Pin
pandit8428-Mar-11 4:20
pandit8428-Mar-11 4:20 
GeneralRe: Can we stop an .exe from anthoer .exe Pin
Stefan_Lang28-Mar-11 5:39
Stefan_Lang28-Mar-11 5:39 
GeneralRe: Can we stop an .exe from anthoer .exe Pin
CPallini28-Mar-11 6:02
mveCPallini28-Mar-11 6:02 
AnswerRe: Can we stop and .exe from anthoer .exe Pin
Rolf Kristensen28-Mar-11 7:07
Rolf Kristensen28-Mar-11 7:07 
GeneralRe: Can we stop and .exe from anthoer .exe Pin
pandit8428-Mar-11 7:19
pandit8428-Mar-11 7:19 
QuestionHow to screenshot as a single color bitmap file? Pin
wangningyu27-Mar-11 17:17
wangningyu27-Mar-11 17:17 
AnswerRe: How to screenshot as a single color bitmap file? Pin
Ozer Karaagac28-Mar-11 14:11
professionalOzer Karaagac28-Mar-11 14:11 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.