Announcement

Collapse
No announcement yet.

Changing Button or Label Text

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Changing Button or Label Text

    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.

  • #2
    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.
    Chris Boss
    Computer Workshop
    Developer of "EZGUI"
    http://cwsof.com
    http://twitter.com/EZGUIProGuy

    Comment


    • #3
      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


      • #4
        Thanks

        Thanks guys! I think it would be best if just stick to a file that gets loaded at run time.

        Comment


        • #5
          Originally posted by Walter Thompson View Post
          Thanks guys! I think it would be best if just stick to a file that gets loaded at run time.
          Nothing to stop you updating the program file when it is not running.

          Comment

          Working...
          X