Modifying resource contents of a running executable

Posted by mrwoik on Stack Overflow See other posts from Stack Overflow or by mrwoik
Published on 2011-01-02T07:30:00Z Indexed on 2011/01/02 8:53 UTC
Read the original article Hit count: 170

Filed under:
|
|
|
|

All,

I store my application settings in a resource. When my program first loads, I read the specified resource using WinAPI. I then parse the retrieved byte data. This works flawlessly for me.

Now let's say that a user alters a setting in my application. He/she checks a checkbox control. I would like to save the updated setting to my resource. However, it seems that my call to UpdateResource will not work while my application is running. I can't modify my resource data even though it is the same size.

First, is it possible to modify a running image's resource data? Second, if that is not possible, what alternatives do I have for storing settings internally within my application?

NOTE: I must have the settings within my running executable. They cannot be on the harddrive or in the registry. Please don't even suggest that as an option.

© Stack Overflow or respective owner

Related posts about c#

Related posts about c++