Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Studio
  4. Conditional compilation of Resources (.RC)

Conditional compilation of Resources (.RC)

Scheduled Pinned Locked Moved Visual Studio
c++csharpvisual-studiowpfcom
10 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    JStrings
    wrote on last edited by
    #1

    I have to create a private label version of my software which means redesigning icons, splash screen, some embedded strings, etc. I've been trying to negotiate the "Condition" box in resource properties but Visual Studio seems to periodically rename, eliminate or simply refuse to create the templates. Does anyone have any experience with something similar: Visual Studio 2010 Language: C/C++ (API--no MFC) Target: Windows Vista and higher I've had the best luck with manually editing the .RC file, at this point... but APPSTUDIO messes with this. One more note... STRINGTABLE entries are next to impossible. Thanks... By the way... if

    TwangGuru www.twangguru.com

    L 1 Reply Last reply
    0
    • J JStrings

      I have to create a private label version of my software which means redesigning icons, splash screen, some embedded strings, etc. I've been trying to negotiate the "Condition" box in resource properties but Visual Studio seems to periodically rename, eliminate or simply refuse to create the templates. Does anyone have any experience with something similar: Visual Studio 2010 Language: C/C++ (API--no MFC) Target: Windows Vista and higher I've had the best luck with manually editing the .RC file, at this point... but APPSTUDIO messes with this. One more note... STRINGTABLE entries are next to impossible. Thanks... By the way... if

      TwangGuru www.twangguru.com

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      You cannot manually edit your .rc files if you are also using Visual Studio to manage them. The best way to do this is to manually create some .rc2 files which are included in the main .rc file during the build process. Previous versions of the Visual Studio wizard used to create one of these automatically.

      Use the best guess

      J 1 Reply Last reply
      0
      • L Lost User

        You cannot manually edit your .rc files if you are also using Visual Studio to manage them. The best way to do this is to manually create some .rc2 files which are included in the main .rc file during the build process. Previous versions of the Visual Studio wizard used to create one of these automatically.

        Use the best guess

        J Offline
        J Offline
        JStrings
        wrote on last edited by
        #3

        Thanks... but my point was that manual editing is the only way I've found to do this... and yes you can manually edit the .RC file in Visual Stucio 2010... it's just the the next time you try to use the visual resource editor it will mess with your work. However, as long as you don't edit sections that are set off by APPSTUDIO_ defines, you can edit to your heart's content. However... dang it... the Visual resource editor provides a "Condition" for compilation... the language condition seems to work, but the Condition does not... no matter where you insert the preprocessor symbol (in the Project Properties, in the resource.h file, on the command line (/D switch of the Resource compiler.) The USED to work with previous version of Visual Studio... what the heck happened. Here's a link from the MSDN Visual Studio discussions: MSDN-Visual Studio Forum: Preprocessor directive for resource inclusion Problem is... this doesn't work as described. Thanks again... -JS P.S. Maybe a clue... the rc.exe command line as shown in the Property Pages for the project is: /D "_DEBUG" /D "TAVVERSION73" /D "_VC80_UPGRADE=0x0710" /D "_UNICODE" /D "UNICODE" /l 0x0409 /v /fo"Debug\%(Filename).res" However, the command line as shown by the project build log is: /D _DEBUG /l"0x0409" /v /fo"Debug\TeleScriptAV.res" TeleScriptAV.RC Where did my additional proprocessor symbols go???!!!

        TwangGuru www.twangguru.com

        L 1 Reply Last reply
        0
        • J JStrings

          Thanks... but my point was that manual editing is the only way I've found to do this... and yes you can manually edit the .RC file in Visual Stucio 2010... it's just the the next time you try to use the visual resource editor it will mess with your work. However, as long as you don't edit sections that are set off by APPSTUDIO_ defines, you can edit to your heart's content. However... dang it... the Visual resource editor provides a "Condition" for compilation... the language condition seems to work, but the Condition does not... no matter where you insert the preprocessor symbol (in the Project Properties, in the resource.h file, on the command line (/D switch of the Resource compiler.) The USED to work with previous version of Visual Studio... what the heck happened. Here's a link from the MSDN Visual Studio discussions: MSDN-Visual Studio Forum: Preprocessor directive for resource inclusion Problem is... this doesn't work as described. Thanks again... -JS P.S. Maybe a clue... the rc.exe command line as shown in the Property Pages for the project is: /D "_DEBUG" /D "TAVVERSION73" /D "_VC80_UPGRADE=0x0710" /D "_UNICODE" /D "UNICODE" /l 0x0409 /v /fo"Debug\%(Filename).res" However, the command line as shown by the project build log is: /D _DEBUG /l"0x0409" /v /fo"Debug\TeleScriptAV.res" TeleScriptAV.RC Where did my additional proprocessor symbols go???!!!

          TwangGuru www.twangguru.com

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          JStrings wrote:

          Problem is... this doesn't work as described.

          I have Visual C++ 2010 Express and it works fine for me.

          Use the best guess

          J 1 Reply Last reply
          0
          • L Lost User

            JStrings wrote:

            Problem is... this doesn't work as described.

            I have Visual C++ 2010 Express and it works fine for me.

            Use the best guess

            J Offline
            J Offline
            JStrings
            wrote on last edited by
            #5

            I use VS2010 Professional... I have a copy of VS2010 Express, but it says "Resource editing is not supported on the Visual Express C++ SKU??? I think this is something new. However, I don't usually use Express... I wonder how the command line is communicated to the resource compiler? I think this is where the problem lies.

            TwangGuru www.twangguru.com

            L 1 Reply Last reply
            0
            • J JStrings

              I use VS2010 Professional... I have a copy of VS2010 Express, but it says "Resource editing is not supported on the Visual Express C++ SKU??? I think this is something new. However, I don't usually use Express... I wonder how the command line is communicated to the resource compiler? I think this is where the problem lies.

              TwangGuru www.twangguru.com

              L Offline
              L Offline
              Lost User
              wrote on last edited by
              #6

              That's correct, the Express editions do not include a resource editor, it all has to be done manually: no big deal. However the conditional compilation feature is exactly the same because both the Professional and Express versions use the same resource compiler. To be honest it is not clear exactly what your problem is, apart from saying that something does not work.

              Use the best guess

              J 1 Reply Last reply
              0
              • L Lost User

                That's correct, the Express editions do not include a resource editor, it all has to be done manually: no big deal. However the conditional compilation feature is exactly the same because both the Professional and Express versions use the same resource compiler. To be honest it is not clear exactly what your problem is, apart from saying that something does not work.

                Use the best guess

                J Offline
                J Offline
                JStrings
                wrote on last edited by
                #7

                Richard... the problem is that conditional compile of resources is NOT working. Adding a symbol to the Project Properties/Resources/General/Preprocessor Definitions (eg. CONDITION1) is not resulting in the resource with Condition set CONDITION1 being added to the .EXE. Because you don't use VS2010 Pro you can't actually see the Resource Properties box. I discovered through analyzing the build log that the command line for rc.exe was shown correctly in Project Properties/Resource/Command Line, but was NOT being communicated to the actual rc.exe command line. Anyway... found a work around. This is to actually add /D "CONDITION1" to Project Properties/Resource/General/Additional Options. Then the command line is formed correctly. BTW... I have to wonder if the issue with my project is that it is very large... over 250,000 lines with hundreds of resource file, and hundreds of source files. In addition, this program has a 10+ year legacy and has been imported and upgraded through several version of VS. I hope this will be helpful to others working on large projects in VS2010 professional.

                TwangGuru www.twangguru.com

                L 1 Reply Last reply
                0
                • J JStrings

                  Richard... the problem is that conditional compile of resources is NOT working. Adding a symbol to the Project Properties/Resources/General/Preprocessor Definitions (eg. CONDITION1) is not resulting in the resource with Condition set CONDITION1 being added to the .EXE. Because you don't use VS2010 Pro you can't actually see the Resource Properties box. I discovered through analyzing the build log that the command line for rc.exe was shown correctly in Project Properties/Resource/Command Line, but was NOT being communicated to the actual rc.exe command line. Anyway... found a work around. This is to actually add /D "CONDITION1" to Project Properties/Resource/General/Additional Options. Then the command line is formed correctly. BTW... I have to wonder if the issue with my project is that it is very large... over 250,000 lines with hundreds of resource file, and hundreds of source files. In addition, this program has a 10+ year legacy and has been imported and upgraded through several version of VS. I hope this will be helpful to others working on large projects in VS2010 professional.

                  TwangGuru www.twangguru.com

                  L Offline
                  L Offline
                  Lost User
                  wrote on last edited by
                  #8

                  I just tried it by adding a definition name (FOOBAR) to the project's resource properties and it compiled correctly; the /D FOOBAR was correctly added to the rc command line. And the resulting executable produced the expected results.

                  Use the best guess

                  J 1 Reply Last reply
                  0
                  • L Lost User

                    I just tried it by adding a definition name (FOOBAR) to the project's resource properties and it compiled correctly; the /D FOOBAR was correctly added to the rc command line. And the resulting executable produced the expected results.

                    Use the best guess

                    J Offline
                    J Offline
                    JStrings
                    wrote on last edited by
                    #9

                    Suffice it to say that it does NOT work with the project that I'm working on at this point... but I'm happy with the work-around I discovered. As I said earlier... the problem probably has to do with a) the size of the program; or b) the number of times the project has been imported through iterations of VisualC++, VisualC.Net, VisualStudio2005, 2010, etc. Thanks to anyone who looked at this...

                    TwangGuru www.twangguru.com

                    L 1 Reply Last reply
                    0
                    • J JStrings

                      Suffice it to say that it does NOT work with the project that I'm working on at this point... but I'm happy with the work-around I discovered. As I said earlier... the problem probably has to do with a) the size of the program; or b) the number of times the project has been imported through iterations of VisualC++, VisualC.Net, VisualStudio2005, 2010, etc. Thanks to anyone who looked at this...

                      TwangGuru www.twangguru.com

                      L Offline
                      L Offline
                      Lost User
                      wrote on last edited by
                      #10

                      JStrings wrote:

                      it does NOT work with the project that I'm working ... the problem probably has to do with a) the size of the program; or b) the number of times the project has been imported

                      In that case there is probably something (or things) in the project that requires correcting, before it causes more problems in the future.

                      Use the best guess

                      1 Reply Last reply
                      0
                      Reply
                      • Reply as topic
                      Log in to reply
                      • Oldest to Newest
                      • Newest to Oldest
                      • Most Votes


                      • Login

                      • Don't have an account? Register

                      • Login or register to search.
                      • First post
                        Last post
                      0
                      • Categories
                      • Recent
                      • Tags
                      • Popular
                      • World
                      • Users
                      • Groups