From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Example Code

Programmatically Modify Stand-Alone Executable's Menu and Menubar Colors

Code and Documents

Attachment

Overview
This VI shows how to change a built executable's menu and menubar colors. This includes both backgrounds and foregrounds (font color). This is done by adding the relevant tokens in the executable's .ini file with the proper hexadecimal colors.

 
Description

By programmatically changing an executable's menu and menubar colors as well as the font color, you can adjust an application to match desired color schemes. This VI shows how to change a color box to a hexadecimal color string, which is then stored in the executable's .ini file (configuration file). This uses the following ini tokens (where ###### is a hexadecimal representation of a color):

menu.background = ######

menu.foreground = ######

menubar.background = ######

menubar.foreground = ######


Requirements

  • LabVIEW 2013 (or compatible)

Steps to Implement or Execute Code

  1. Open the zip project and build the executable (make sure to specify a directory in the build properties). Open menu_color.exe.
  2. You can also open the attached executable menu_color.exe (LabVIEW 2013 only).
  3. Change the colors of the 4 color boxes on the executable's window. You can reset them to the default values by pressing the "Default" button.
  4. When ready, press the "GO" button. This will add the proper tokens to the executable's configuration file.
  5. Since the executable is already open, you need to close it in order to see the changes. By clicking "Stop", the application will close itself.
  6. Reopen menu_color.exe. Notice how the menu and menubar as well as their fonts have updated colors.

 

Additional Information or References
VI Block Diagram 

 

menu_screenshot.png

 1.png

 

(note: because of the nature of this VI, uploading a snippet is very impractical. You will need to download the attached files in order to access the block diagram)

 

**This document has been updated to meet the current required format for the NI Code Exchange.**

 

 

Xavier

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.