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. C#
  4. switching resources - at design time or compile time

switching resources - at design time or compile time

Scheduled Pinned Locked Moved C#
visual-studiocomdesignwindows-admintools
4 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.
  • B Offline
    B Offline
    BlackDice
    wrote on last edited by
    #1

    Hello. I'm using VS 2005 and I have taken over a project that has images included in the resources of the project that are visible by going to the project's properties sheet and clicking on the 'Resources' tab. Is there a way I can update this while building? For instance, there's about 50 images in there now associated with 'Company 1'. I'd like to have it where I can use different images when I do a build, depending on whether COMPANY1 or COMPANY2 is defined for that build configuration. Even doing it dynamically at runtime depending on a registry setting or something if I could put the images in a .resx file and have the program use that instead of the ones in the 'Resources' tab. Thanks in advance

    My Music | My Pics | My Articles BlackDice

    L 1 Reply Last reply
    0
    • B BlackDice

      Hello. I'm using VS 2005 and I have taken over a project that has images included in the resources of the project that are visible by going to the project's properties sheet and clicking on the 'Resources' tab. Is there a way I can update this while building? For instance, there's about 50 images in there now associated with 'Company 1'. I'd like to have it where I can use different images when I do a build, depending on whether COMPANY1 or COMPANY2 is defined for that build configuration. Even doing it dynamically at runtime depending on a registry setting or something if I could put the images in a .resx file and have the program use that instead of the ones in the 'Resources' tab. Thanks in advance

      My Music | My Pics | My Articles BlackDice

      L Offline
      L Offline
      Luc Pattyn
      wrote on last edited by
      #2

      Maybe what you need is 3 projects (1 dll and 2 exe): 1 dll with all or most of the code 1 exe for each company, including all the appropriate images and referencing the code dll. Alternative: You could create extra projects with an image-only dll for each company, and keep all code in the single exe, which then dynamically loads the right image dll. (search for "late binding" on CP). :)

      Luc Pattyn

      B 1 Reply Last reply
      0
      • L Luc Pattyn

        Maybe what you need is 3 projects (1 dll and 2 exe): 1 dll with all or most of the code 1 exe for each company, including all the appropriate images and referencing the code dll. Alternative: You could create extra projects with an image-only dll for each company, and keep all code in the single exe, which then dynamically loads the right image dll. (search for "late binding" on CP). :)

        Luc Pattyn

        B Offline
        B Offline
        BlackDice
        wrote on last edited by
        #3

        I think the alternative solution would be what I would like to go with. however, I still don't have a clue as to how to tell the .exe to use the image dll as opposed to using the images that are in 'Resources' on the properties page for the project.

        My Music | My Pics | My Articles BlackDice

        L 1 Reply Last reply
        0
        • B BlackDice

          I think the alternative solution would be what I would like to go with. however, I still don't have a clue as to how to tell the .exe to use the image dll as opposed to using the images that are in 'Resources' on the properties page for the project.

          My Music | My Pics | My Articles BlackDice

          L Offline
          L Offline
          Luc Pattyn
          wrote on last edited by
          #4

          Well, I have not done this myself, but this is how I understand it: - you make a new project targetting a dll instead of an exe, and you add your images to that project just as you did so far for your exe project - in your existing exe project, you remove the images you currently have as resources; and you add code to decide which image dll is required (assuming you did build more than one image dll), you then load it dynamically, and then get the images from there. For dynamic dll load, and how to get at its content, please search "late binding" on CP. Come to think of it, there must be yet another alternative, based on internationalization; this is an official mechanism to support alternate sets of resources, normally intended to easily port your app to other languages/countries without changing the main code. I guess you could use it to just substitute alternate sets of images (and maybe some strings, such as company name). This too I have never done, and it also involves extra dlls, so it is very similar (if not identical) to what I described earlier. One possible difference is internationalization also supports a "default" country/language, which can be built-in (i.e. when no country-specific dlls are available or selected). More on this surely in the MS documentation. :) -- modified at 14:22 Monday 29th January, 2007

          Luc Pattyn

          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