Is it possible to programmatically change the text on a button or label permanently? I know that this can be done by saving the new text to a file and loading the file each time the program is launched. what I would like to do is change the button text in the program file.
Announcement
Collapse
No announcement yet.
Changing Button or Label Text
Collapse
X
-
As long as your application is being run on Windows 2000, XP or Vista, you can use the UpdateResource API function to modify the resources, which can be text strings. You simply compile an RC file (resource file) with all the default text strings you want and use the #RESOURCE compiler directive to add the compiled resources (PBR file) into the EXE.
Then using the UpdateResource API function you can modify those resources in the compiled EXE.
The only thing I am not sure of, is whether this can be done while the EXE is being executed. Maybe someone else could shed some light on that.
-
No,you can't update an executable's (EXE or DLL) resources whilst in use.
But if you put your dialog template into a 'resource only' DLL you could update that DLL's resources from your EXE. Heck it wouldn't even have to be the entire dialog template, you could have a DLL with a STRINGTABLE resource.Michael Mattias
Tal Systems (retired)
Port Washington WI USA
[email protected]
http://www.talsystems.com
Comment
Comment