Using #defined values ββin Visual Studio Dialog Dialog Scripts?
I am trying to create an About window for my Windows C ++ application. In Visual Studio 2008, I am using the dialog editor to create a dialog. I want the About window to display the application version in a static label.
I can copy the version in the dialog saved in the file .rc
, but then I have to remember to update the version in several places.
My app version #define
d is in version.h
like APPLICATION_VERSION
. The resource editor can be convinced that
#include "version.h"
at the top of the file .rc
, so I have access to the symbol APPLICATION_VERSION
.
However, I cannot use this symbol from the dialog editor. I can edit the file .rc
manually by replacing the hard-coded string with a character APPLICATION_VERSION
. This works fine until I edit the dialog again in the dialog editor: when saving .rc
in the dialog editor, the symbol will be overwritten with its current value.
Of course, I can set the version label to some dummy text, overriding this text when I receive it WM_INITDIALOG
, but this is very inconvenient and unnecessary. Is there any other workaround that allows me to keep the version of the application in one place?
source to share
I do this to put the resource in a separate file with an extension .rc2
and #include
in a file .rc
(for example, with yours version.h
). Then I edit the files .rc2
using a regular text editor, not the Visual Studio resource editor.
This system isn't all that bad for resources VERSIONINFO
, which is what I'm using it for, but I see it will hurt more for dialogue resources. I'd love to hear a better way, but I don't know one.
source to share