switching resources - at design time or compile time
-
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
-
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
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
-
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
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
-
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
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