CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Jan 2005
    Location
    Akron, Ohio
    Posts
    670

    [RESOLVED] Replace resources of new project with old

    I'd like to completely replace the resources of a new project with those of an old. I've tried deleting the .rc file of the new and replacing it with the old (renamed to mimic the new), but the darn thing still thinks I want the new resources. How can I get this to replace?

    I'm using Visual Studio 2010, but I still walk uphill in the snow both ways.

    Thanks
    error C2146a : syntax error : nebulizer stained in the tower floppy apple rider. Go rubble in flee smite. Bleeble snip snip.

    Documentation says: error C2146a - This means there is an error somewhere in the course of human endeavor. Fix in the usual way.

  2. #2
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Replace resources of new project with old

    Did you replace the resource,h together with .rc?
    Did you do the Rebuild All after that?
    Victor Nijegorodov

  3. #3
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: Replace resources of new project with old

    but the darn thing still thinks I want the new resources. How can I get this to replace?
    I dare say, the thing isn't able to think, it just reacts to the instruction that you give it. Do it right, or react back to the error messages the thing provides and correct yourself, or let us see the messages to help you to react correct way.
    Best regards,
    Igor

  4. #4
    Join Date
    Jan 2005
    Location
    Akron, Ohio
    Posts
    670

    Re: Replace resources of new project with old

    VictorN,

    Thank you for your patience. Here are the steps I took:
    1) I deleted the new Resource.h and .rc files entirely and copied the old files from the old project folder into the new project folder.
    2) I added these old files to the new project in VC 2010 via "add -> existing item..."
    3) I rebuilt the project, and I'm getting thousands of errors about not knowing what the various resource names are (i.e. error C2065: 'IDD_CLIENT_CONNECTION_DIALOG' : undeclared identifier, etc.) In addition, the resource view STILL shows the new resources.

    Where else is this information being stored if not in the .h and .rc folder?


    Igor,

    Thank you for your reply, and I apologize for the lack of technical precision in my original post. I thought my statement that I deleted the old .rc file and replaced it with the new one was descriptive enough . . . especially for someone else who might know of the two or three other steps I'm probably missing. Listing thousands of errors seems overkill. I am well aware that computer's do not "think," at least insofar as we regard that concept. Computers also don't use common vernacular that suffices to get the point across. If they did, we probably wouldn't need forums.
    error C2146a : syntax error : nebulizer stained in the tower floppy apple rider. Go rubble in flee smite. Bleeble snip snip.

    Documentation says: error C2146a - This means there is an error somewhere in the course of human endeavor. Fix in the usual way.

  5. #5
    VictorN's Avatar
    VictorN is offline Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Hanover Germany
    Posts
    20,430

    Re: Replace resources of new project with old

    Quote Originally Posted by paradoxresolved View Post
    ...
    1) I deleted the new Resource.h and .rc files entirely and copied the old files from the old project folder into the new project folder.
    Does the "old" .rc file have the same name as the "new" one that you have deleted?
    Victor Nijegorodov

  6. #6
    Join Date
    Nov 2000
    Location
    Voronezh, Russia
    Posts
    6,633

    Re: Replace resources of new project with old

    2) I added these old files to the new project in VC 2010 via "add -> existing item..."
    That was unnecessary. Just replacing the files contents (including res folder of course) and probably killing .ncb/.sdf file would do. You could do a little training session like creating some dummy project, making changes to resources, taking the closed project snapshot, making further changes, closing the project and trying to replace the resource related stuff from the snapshot you previously have taken. With a diffing tool, like WinMerge you could clearly see the changes. Well, the easiest case would be if some version control system was in use.

    Listing thousands of errors seems overkill.
    At least "the darn thing still thinks I want the new resources" needed to be illustrated somehow.
    Last edited by Igor Vartanov; December 17th, 2011 at 06:38 PM.
    Best regards,
    Igor

  7. #7
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: Replace resources of new project with old

    Here is how to import resource files (or parts of resource files) contents in a "visual" manner.
    It avoids "manually" working with .RC files and implicitly prevents headaches because of eventually inconsistencies and conflicts (between resource IDs, and so on).

    • In "Solution Explorer" window, right click in .RC file name, select "Open with...", then "Resource Editor".
    • Chose "File/Open/File..." menu (or hit Ctrl+O)
    • Find, select then open the "import" .RC file.
    • Select "Window/New Vertical Tab Group".


    Now, you can see both resource files contents side by side
    Further, it's a piece of cake to copy & paste or drag & drop from one to another.
    Attached Images Attached Images
    Last edited by ovidiucucu; December 18th, 2011 at 04:39 AM.
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  8. #8
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: Replace resources of new project with old

    [ continued ]

    One even simpler method is to (temporarily) add in the solution, the project containing the resources to be imported
    This case you can enjoy of copy & paste or drag & drop directly in the "Resource View" window.
    After importing is done, you may remove that project from the solution.
    Attached Images Attached Images
    Last edited by ovidiucucu; December 18th, 2011 at 04:42 AM. Reason: typos
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  9. #9
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,244

    Re: Replace resources of new project with old

    [ continued ]

    And yet another one:
    • In "Solution Explorer" window, right ckick on "Resource Files" branch, then choose "Add/Existing Item..." menu.
    • Search then open the .RC file to whit the resources to be imported.
    • Copy & paste or drag & drop in "Resource View" window.
    • When import is done, remove the import .RC file from the project.


    And sould be more...
    Attached Images Attached Images
    Ovidiu
    "When in Rome, do as Romans do."
    My latest articles: https://codexpertro.wordpress.com/

  10. #10
    Join Date
    Jan 2005
    Location
    Akron, Ohio
    Posts
    670

    Re: Replace resources of new project with old

    ovidiucucu,

    The second method worked quite well! Thank you!
    error C2146a : syntax error : nebulizer stained in the tower floppy apple rider. Go rubble in flee smite. Bleeble snip snip.

    Documentation says: error C2146a - This means there is an error somewhere in the course of human endeavor. Fix in the usual way.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured