I'm trying to create an About box for my Windows C++ application. In Visual Studio 2008, I'm using the dialog editor to design the dialog. I want the About box to display the application's version in a static label.
I can hardcode the version into the dialog, stored in a .rc
file, but then I'll have to remember to update the version in multiple places.
My application version is #define
d in version.h
as APPLICATION_VERSION
. The resource editor can be convinced to put
#include "version.h"
at the top of the .rc
file, so I have access to the APPLICATION_VERSION
symbol.
However, I cannot use this symbol from the dialog editor. I can edit the .rc
file by hand, replacing the hardcoded version string by the symbol APPLICATION_VERSION
. That works fine until I edit the dialog in the dialog editor again: upon saving the .rc
from the dialog editor, the symbol gets overwritten with its current value.
Of course, I can set the version label to some dummy text, overriding that text when I receive WM_INITDIALOG
, but that feels very clunky and unnecessary. Is there any other workaround that allows me to keep the application version in a single place?