locked
Write to Resource Script File (*.rc) from VSPackage RRS feed

  • Question

  • Hi,

    I want to add entries to a string table in a resource file (VC++ Project). I have created a VSPackage and want to achieve this programmatically.

    Is there a comfortable way or do I have to open my RC file in text mode and handle everything myself? The only way I figured out so far is:

     

       foreach (EnvDTE.Project prItem in dte.Solution.Projects)
       {
        foreach (EnvDTE.ProjectItem proItem in prItem.ProjectItems)
        {
         if(proItem.Name.Equals("Resource Files"))
         {
          foreach (EnvDTE.ProjectItem rcItem in proItem.ProjectItems)
          { 
           if(rcItem.Name.EndsWith(".rc"))
           {
            string test;
           }
          }
         }
         
        }
       }
    

     

    and then open it in "Text Mode" to add my string ID's and strings.

     

    Is there a better and easier solution?

    Thx for your help in advance,

    Regards maecky


    Tuesday, July 12, 2011 3:50 PM

Answers

  • Hi Maechky,

    The VC++ resource editor doesn't have any exposed APIs or automation functionality that will let you add additional strings to a string table. This particular editor has always been unfriendly when it comes to automation or extnsibility. Your best bet is to use the solution you propose. Find the file(s) that you want to edit, then just open and modify them as needed. It's an ugly solution, but it's the only option we have with this particular editor.

    Sincerely,


    Ed Dore
    Tuesday, July 12, 2011 8:15 PM

All replies

  • Hi Maechky,

    The VC++ resource editor doesn't have any exposed APIs or automation functionality that will let you add additional strings to a string table. This particular editor has always been unfriendly when it comes to automation or extnsibility. Your best bet is to use the solution you propose. Find the file(s) that you want to edit, then just open and modify them as needed. It's an ugly solution, but it's the only option we have with this particular editor.

    Sincerely,


    Ed Dore
    Tuesday, July 12, 2011 8:15 PM
  • Thanks for your answer,

    I thought so, but i hoped that there is a better solution ;)

     

    Regards

    Monday, July 18, 2011 8:50 AM