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. .NET (Core and Framework)
  4. resources in exe?

resources in exe?

Scheduled Pinned Locked Moved .NET (Core and Framework)
questioncsharplearning
7 Posts 3 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.
  • C Offline
    C Offline
    CherezZaboro
    wrote on last edited by
    #1

    Sorry, but I got very basic noob question: When I add a string to resources of a .NET win app on "Resources" tab in Properties of the project and I can use the string in code like so: "Properties.Resources.str" instead of hard coding the string in, right? Why can't I see the string in the executable itself (with a resource editor)? I need to be able to change the string in there without recompiling. Thanks a lot!

    L D 2 Replies Last reply
    0
    • C CherezZaboro

      Sorry, but I got very basic noob question: When I add a string to resources of a .NET win app on "Resources" tab in Properties of the project and I can use the string in code like so: "Properties.Resources.str" instead of hard coding the string in, right? Why can't I see the string in the executable itself (with a resource editor)? I need to be able to change the string in there without recompiling. Thanks a lot!

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

      You are not supposed to modify the content of executable files such as EXE and DLL. How do you expect to replace a string by a longer string in there and keep all pointers/references correct ? For your own safetym executable files are protected by checksums and/or signatures. So if you manage to alter their content, the system will refuse to run them. EXE and DLL files should be the unmodified result of running some tool, first candidate is the linker that gets invoked when building with Visual Studio. There is a concept of "Internationalization" that lets you put regional stuff into separate DLLs (say one per language). In that sense, you can change a language-specific DLL, without really changing the app itself. If that is what you need, look it up! There also is a concept of a "settings file" that lets you put some initial values in a file. If that is what you need, look it up! :)

      Luc Pattyn


      try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }


      C 1 Reply Last reply
      0
      • L Luc Pattyn

        You are not supposed to modify the content of executable files such as EXE and DLL. How do you expect to replace a string by a longer string in there and keep all pointers/references correct ? For your own safetym executable files are protected by checksums and/or signatures. So if you manage to alter their content, the system will refuse to run them. EXE and DLL files should be the unmodified result of running some tool, first candidate is the linker that gets invoked when building with Visual Studio. There is a concept of "Internationalization" that lets you put regional stuff into separate DLLs (say one per language). In that sense, you can change a language-specific DLL, without really changing the app itself. If that is what you need, look it up! There also is a concept of a "settings file" that lets you put some initial values in a file. If that is what you need, look it up! :)

        Luc Pattyn


        try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }


        C Offline
        C Offline
        CherezZaboro
        wrote on last edited by
        #3

        Well in regular Win Apps (non .NET) you can change resources just fine with a resource editor without having to recompile the exe. But so I guess in .NET you can't. What's the point of the resources then (besides reusability)? And why are there some resources in the exe that are visible in resource editor and others not?

        L 1 Reply Last reply
        0
        • C CherezZaboro

          Well in regular Win Apps (non .NET) you can change resources just fine with a resource editor without having to recompile the exe. But so I guess in .NET you can't. What's the point of the resources then (besides reusability)? And why are there some resources in the exe that are visible in resource editor and others not?

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

          A resource editor has to preserve the correctness and consistency of an EXE or DLL file. Why Microsoft has choosen to offer that as a separate tool in the past, and not to do that anymore, I don't know. I don't care much what the tool is called; you hit a button, and it happens. Today it is the same button all the time... Most if not all of the advantages of resources remain intact: you can store non-code items in a DLL (rather than embed them in the middle of your code), hence reuse it across several projects, and, thru internationalization, replace it as you see fit. A variant is "personalization" where you would be selling almost the same application to several big customers; if well organized you just need to replace some images, icons, strings that may all reside in a single DLL. If unhappy, fire your complaints towards Microsoft... :)

          Luc Pattyn


          try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }


          C 1 Reply Last reply
          0
          • C CherezZaboro

            Sorry, but I got very basic noob question: When I add a string to resources of a .NET win app on "Resources" tab in Properties of the project and I can use the string in code like so: "Properties.Resources.str" instead of hard coding the string in, right? Why can't I see the string in the executable itself (with a resource editor)? I need to be able to change the string in there without recompiling. Thanks a lot!

            D Offline
            D Offline
            dekart_roo
            wrote on last edited by
            #5

            If you need to read in the value of a string that's subject to configuration, why not store\read from the registry?

            C 1 Reply Last reply
            0
            • L Luc Pattyn

              A resource editor has to preserve the correctness and consistency of an EXE or DLL file. Why Microsoft has choosen to offer that as a separate tool in the past, and not to do that anymore, I don't know. I don't care much what the tool is called; you hit a button, and it happens. Today it is the same button all the time... Most if not all of the advantages of resources remain intact: you can store non-code items in a DLL (rather than embed them in the middle of your code), hence reuse it across several projects, and, thru internationalization, replace it as you see fit. A variant is "personalization" where you would be selling almost the same application to several big customers; if well organized you just need to replace some images, icons, strings that may all reside in a single DLL. If unhappy, fire your complaints towards Microsoft... :)

              Luc Pattyn


              try { [Search CP Articles] [Search CP Forums] [Forum Guidelines] [My Articles] } catch { [Google] }


              C Offline
              C Offline
              CherezZaboro
              wrote on last edited by
              #6

              Chill out, man! I'm not firing complains toward anybody, especially you since you don't know... If unhappy, fire back your complaints through UN... That was helpful. :zzz:

              1 Reply Last reply
              0
              • D dekart_roo

                If you need to read in the value of a string that's subject to configuration, why not store\read from the registry?

                C Offline
                C Offline
                CherezZaboro
                wrote on last edited by
                #7

                Thanks for reply. Sure I can store things anywhere really. There's always a set of different approaches to anything. I just want to get the answer to this particular question. That's all.

                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