Resource view takes hangs when trying to edit rc file
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 6 of 6

Thread: Resource view takes hangs when trying to edit rc file

  1. #1
    Join Date
    Oct 2001
    Location
    lake of fire and brimstone
    Posts
    1,617

    Resource view takes hangs when trying to edit rc file

    No idea how to solve it. Found an online suggestion of using an rc2 file and cut and paste stuff from .rc file to .rc2 file to see which line causes the problem but don't know how to create a blank .rc2 file. Problem started after I ported from VC++ 6 to VS2010.
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞

  2. #2
    VictorN's Avatar
    VictorN is online now Super Moderator Power Poster
    Join Date
    Jan 2003
    Location
    Wallisellen (ZH), Switzerland
    Posts
    17,360

    Re: Resource view takes hangs when trying to edit rc file

    .rc2 file is created by AppWizard and is placed into project res folder.
    Victor Nijegorodov

  3. #3
    Join Date
    Dec 2012
    Location
    England
    Posts
    2,335

    Re: Resource view takes hangs when trying to edit rc file

    Resource files have the extension .rc. These files can be copied like any other file. So if your original .rc file is called res.rc then a copy could be called res2.rc. These .rc files are text and can be edited. For your project, the solution explorer window states which .rc file(s) are used under the Resource Files branch of the tree. To use another .rc file, right click the existing name and choose remove. Then right click the Resource Files branch and choose Add, Add Existing Item and select the new resource file.

    You can also right click on the .rc file in the Solution Explorer and choose Open With and then select Source Code (Text) Editor. This will display the .rc file within VS as a text file that can be edited and then saved.
    All advice is offered in good faith only. You are ultimately responsible for effects of your programs and the integrity of the machines they run on.

  4. #4
    ovidiucucu's Avatar
    ovidiucucu is offline Moderator/Reviewer Power Poster
    Join Date
    Feb 2003
    Location
    Iasi - Romania
    Posts
    8,021

    Re: Resource view takes hangs when trying to edit rc file

    Normally, should be not any problem with resources when porting to a newer Visual Studio version.
    And, if something is wrong in the resource script (.rc) file, the resource editor should not hang but give a message box describing the error and having two buttons "OK" and "Edit Code".
    If push "Edit Code", the IDE opens the .rc file in a text editor, pointing to the wrong line.

    Well, let's say: "Shi_t happens!".

    Most possible, you got problems because of some manually edited stuff in the original project.
    Just to note: the .rc file contains a lot of stuff generated by the Visual Studio IDE.
    I highly recommend to avoid manually editing it (by using a text editor), because:
    1. your changes may be lost when further change resources by using the resource editor;
    2. you can do mistakes.

    However if really, really need it (in rare cases), then can use that .rc2 file, which is for "non-Microsoft Visual C++ edited resources", i.e. for manually edited resources. The .rc2 file is usually generated by the wizard for some types of projects, as Victor already said, and included in the .rc file (using #include directive). If it's not present in your project, you can add one yourself and include it like the wizard does.
    Then, you can put there resource stuff that can be manually edited with no fear.
    But again, do that only if it's absolutely necessary and if you are sure what you are doing.

    Probably, one "code monkey", desperately searching for a solution, has moved the blocks one by one. from .rc to the .rc2 file until the resource has been successfully loaded.
    I think, the wrong block can be found even easier by commenting in the .rc file.

    But I would like to recommend something else.
    In VC6.0, open the resource editor and do some minor change (e.g. move a button one unit to the right). Save or compile/build, close VC6.0 then port the project in newer Visual Studio version. That way, you force the IDE to correctly re-generate the resource script file and get rid of manually added mistakes. If some important changes has been also lost, you can add them back in the ported project, eventually using 2kaud suggestions. But again, beware of my above remarks!

    Finally, AFAIK, the resource editor may also fail in loading resources if the .rc file refer to an ActiveX control that is not registered. Although this is less possible in this context, it's good to be noted and checked, as well.
    Last edited by ovidiucucu; March 17th, 2013 at 02:37 AM.
    Ovidiu Cucu
    "When in Rome, do as Romans do."
    Visit: Microsoft Virtual Academy
    Follow: https://twitter.com/#!/ovidiucucu
    My blog: http://codexpert.ro/blog/author/ovidiu-cucu/

  5. #5
    Join Date
    Oct 2001
    Location
    lake of fire and brimstone
    Posts
    1,617

    Re: Resource view takes hangs when trying to edit rc file

    Quote Originally Posted by ovidiucucu View Post
    Most possible, you got problems because of some manually edited stuff in the original project.
    You are correct that I made manual changes in the original project. However, back then in VC++ 6.0 this was never a problem and always loaded correctly. I cannot undo that now however. I did find the .rc2 file, I've never used it and it is indeed where located.

    Quote Originally Posted by ovidiucucu View Post
    Probably, one "code monkey", desperately searching for a solution, has moved the blocks one by one. from .rc to the .rc2 file until the resource has been successfully loaded.
    I think, the wrong block can be found even easier by commenting in the .rc file.
    I think I'll try that, thank you.


    Quote Originally Posted by ovidiucucu View Post
    But I would like to recommend something else.
    In VC6.0, open the resource editor and do some minor change (e.g. move a button one unit to the right). Save or compile/build, close VC6.0 then port the project in newer Visual Studio version. That way, you force the IDE to correctly re-generate the resource script file and get rid of manually added mistakes. If some important changes has been also lost, you can add them back in the ported project, eventually using 2kaud suggestions. But again, beware of my above remarks!
    The problem I have is that the laptop on which I had VC6.0 was stolen. I now only have VS2010 and we no longer have the installation CD of VC6.0. I had previously converted the project successfully on my old laptop but now things are not working the same. I am now reconverting an older saved version and trying to get it back up to date.
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞

  6. #6
    Join Date
    Oct 2001
    Location
    lake of fire and brimstone
    Posts
    1,617

    Re: Resource view takes hangs when trying to edit rc file

    Somehow the lines with "design info" or whatever of a whole bunch of dialogs I have, were what caused the problems. Those lines don't seem necessary at first sight so I just threw them out. Everything looks fine now.

    /////////////////////////////////////////////////////////////////////////////
    //
    // DESIGNINFO
    //
    /*
    #ifdef APSTUDIO_INVOKED
    GUIDELINES DESIGNINFO
    BEGIN
    IDD_RUN, DIALOG
    BEGIN
    , 50
    END

    IDD_GRAPH_OPTIONS, DIALOG
    BEGIN
    , 50
    END

    IDD_AXES_RANGE, DIALOG
    BEGIN
    , 50
    END

    IDD_PARAGRAPH, DIALOG
    BEGIN
    , 50
    END

    IDD_CARDDRUMPAIR, DIALOG
    BEGIN
    , 50
    END

    IDD_CARDDRUM, DIALOG
    BEGIN
    , 50
    END

    IDD_SURF_TEETH, DIALOG
    BEGIN
    , 50
    END

    IDD_SETTINGSRIGHTVIEW, DIALOG
    BEGIN
    , 50
    END

    IDD_SETTINGSLEFTVIEW, DIALOG
    BEGIN
    , 50
    END
    END
    #endif // APSTUDIO_INVOKED
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞
    ۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞۞

Posting Permissions

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


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center