Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8842109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T10:53:00+00:00 2026-06-14T10:53:00+00:00

My app requires me to change logos and icons every time it is compiled

  • 0

My app requires me to change logos and icons every time it is compiled for each customer. Doing this by hand is, naturally, time consuming and error prone, so I have written the .Net form to load its images and icons from a .rc file, but I’m trying to work some preprocessor magic in the resources file.

My goal is to have it automatically load only one image and icon from a directory that has the customer’s id. This will prevent the .rc file from linking unneeded images and files, and make setup for each customer as simple as a single prepcessor command.

I have a token called “CUSTOMER_ID” that is the folder name of their resources. So, their files would be in “../files/images/customer1/” where CUSTOMER_ID = customer1.

I want to get the preprocessor to concatenate the constant of “..files/images/” with CUSTOMER_ID, followed by “icon.ico” or “logo.bmp” so that I can define the resource. This is what I have currently:

//in resources.rc
#include "airline.h"
#define CONCAT(dir, cid, filetype) dir ## cid ## filetype

IDI_ICON1 ICON  CONCAT("../files/images/",CUSTOMER_ID,"icon.ico")

However, the results always end up off. Advice?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T10:53:02+00:00Added an answer on June 14, 2026 at 10:53 am

    For RC files preprocessor directives are very limited, see: http://msdn.microsoft.com/en-us/library/windows/desktop/aa381033(v=vs.85).aspx

    
    Directive   Description
    #define         Defines a specified name by assigning it a given value.
    #elif           Marks an optional clause of a conditional-compilation block.
    #else           Marks the last optional clause of a conditional-compilation block.
    #endif          Marks the end of a conditional-compilation block.
    #if         Conditionally compiles the script if a specified expression is true.
    #ifdef          Conditionally compiles the script if a specified name is defined.
    #ifndef         Conditionally compiles the script if a specified name is not defined.
    #include    Copies the contents of a file into the resource-definition file.
    #undef          Removes the definition of the specified name.
    
    

    And #define is of simple form: (after http://msdn.microsoft.com/en-us/library/windows/desktop/aa381061(v=vs.85).aspx):

    #define name value
    

    There is solution – according to this answer prepare your ICON/BITMAPS paths as environment variables, you can build them from costumer name – but it must be done in your batchFile or makefile:

    From the already mentioned answer:

    In your project properties add ;$(CMDLINE_DEFINES) to the end of your resource preprocessor definitions. (Be sure to pick the right configuration.)
    
    Then when you use MSBuild from the command line type (or add to a batch file)...
    
    C:\Projects\SomeProject> set CMDLINE_DEFINES=SOMETEST=42
    C:\Projects\SomeProject> MSBuild SomeProject.vcproj
    

    This answer was for C++ files:


    For your example:

    CONCAT("../files/images/",CUSTOMER_ID,"icon.ico")
    

    You should use such macro:

    #define TOSTRING(T) #T
    #define CONCAT(dir, cid, filetype) dir TOSTRING(cid) filetype
    

    This is because this macro expansion is: "../files/images/" "customer1" "icon.ico". And the C++ compiler will concatenate adjacent string literals.

    This example:

    #include <iostream>
    
    #define TOSTRING(T) #T
    #define CONCAT(dir, cid, filetype) dir TOSTRING(cid) filetype
    
    #define CUSTOMER_ID customer1
    
    int main() {
        std::cout << ">>>>>" << CONCAT("../files/images/",CUSTOMER_ID,"icon.ico") << "<<<<\n";
    }
    

    will produce output:

    >>>>>../files/images/customer1icon.ico<<<<
    

    Possible you should add / before icon.ico…

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My app requires the following parameters of mobile network: MCC (Mobile Country Code) MNC
My app requires a lot of image resources, so I've had to package them
My android app requires that the device has an SDcard and that SDcard is
I have a problem. Part of my app requires text to be shown in
I'm trying to set the UIRequiredDeviceCapabilities properties in my Info.plist file. My app requires
I am creating a Table View in viewDidAppear, because my app requires it to
I have an app which requires downloading image asynchronously in base64 encoded string(server is
I have an app that requires user to register. I've got the app conected
I am building an app which requires saving a form whenever user enter the
I am creating an app that requires some settings to be set first before

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.