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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to modify resources in a compiled exe file ?

How to modify resources in a compiled exe file ?

Scheduled Pinned Locked Moved C / C++ / MFC
graphicsjsonhelptutorialquestion
4 Posts 3 Posters 3 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.
  • A Offline
    A Offline
    Atom
    wrote on last edited by
    #1

    I have come across what seems to be a complicated problem. I need to add string resources and bitmap resources to an exe file after it is compiled. Anyone have any ideas ???, any WIN API functions that can do this ???. Many thanks.

    J H 2 Replies Last reply
    0
    • A Atom

      I have come across what seems to be a complicated problem. I need to add string resources and bitmap resources to an exe file after it is compiled. Anyone have any ideas ???, any WIN API functions that can do this ???. Many thanks.

      J Offline
      J Offline
      James R Twine
      wrote on last edited by
      #2

      This is simple to do - this has been possible since before the 3.1 days ...    An easy example of this is to use VC++ 6.0 to open an executable (EXE or DLL) file and change the "Open As" type to Resources - you can then view, add, edit and even delete the resources of the application, save the changes back to the executable and then run the application again.    This is the #1 reason why you should never rely on the resources to enforce the behavior of your application (for example, if an edit control should be read-only or disabled, then make sure it is read-only/disabled by setting its style explicitly at runtime).  This is something that nails naive developers when they want to do something like release a limited version of their app, but the limits are enforced strictly via the resources.  This can also be a good thing - it allows well-written apps that keep all strings in their resources to be localized without access to the source code.    Using the APIs to do this is a bit tricky (and note that the APIs were not originally available on Win95, but only on WinNT) - it is easier to use something like VC++ 6.0 to do it.    Do you really need to know the APIs, or can you just use VC++ 6.0 to make the necessary changes?    Peace!

      -=- James


      If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
      Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
      DeleteFXPFiles & CheckFavorites (Please rate this post!)

      A 1 Reply Last reply
      0
      • A Atom

        I have come across what seems to be a complicated problem. I need to add string resources and bitmap resources to an exe file after it is compiled. Anyone have any ideas ???, any WIN API functions that can do this ???. Many thanks.

        H Offline
        H Offline
        Hamid Taebi
        wrote on last edited by
        #3

        See UpdateResource By DavidCrow. [^] I think its helpful for you


        WhiteSky


        1 Reply Last reply
        0
        • J James R Twine

          This is simple to do - this has been possible since before the 3.1 days ...    An easy example of this is to use VC++ 6.0 to open an executable (EXE or DLL) file and change the "Open As" type to Resources - you can then view, add, edit and even delete the resources of the application, save the changes back to the executable and then run the application again.    This is the #1 reason why you should never rely on the resources to enforce the behavior of your application (for example, if an edit control should be read-only or disabled, then make sure it is read-only/disabled by setting its style explicitly at runtime).  This is something that nails naive developers when they want to do something like release a limited version of their app, but the limits are enforced strictly via the resources.  This can also be a good thing - it allows well-written apps that keep all strings in their resources to be localized without access to the source code.    Using the APIs to do this is a bit tricky (and note that the APIs were not originally available on Win95, but only on WinNT) - it is easier to use something like VC++ 6.0 to do it.    Do you really need to know the APIs, or can you just use VC++ 6.0 to make the necessary changes?    Peace!

          -=- James


          If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong!
          Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road!
          DeleteFXPFiles & CheckFavorites (Please rate this post!)

          A Offline
          A Offline
          Atom
          wrote on last edited by
          #4

          Thanks for the good advice, I need to know the API's to be able to modify exe resources programmatically, using visual c++ manually does not solve my problem. A simple example of the stuff I need to do: The program I am writing "Program B" needs to take user input, for example: "This is my String" is entered into an Edit ctrl. A string resource with a value of "This is my String" then needs to be created in "Program A"(ProgA.exe). So when "Program A"(ProgA.exe) is executed it is able to display "This is my String" in a msg box/window etc... I will look into the API's you have told me about, I think they will be a great help. Once again, Many thanks.

          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