For anyone who cares: the .rc file is a resource file from an MFC project that defines user interface elements such as dialog layouts. It uses the same preprocessor as C ++, but does not support C ++ syntax - and in the window's CAPTION field, two string literals are not combined, just matching them. Inside a string literal, two double quotes are actually an escape sequence that generates a single double quote character. So literally:
"Hello""World"
looks like
Hello"World
In the dialog box Window.
The problem with the above example:
CAPTION "Hello"STRINGIZE(Word_)
This means that the double quote at the end of "Hello" must be removed, but the preprocessor cannot do this. However, if "Hello" is allowed to be included in the macro, concatenation is possible. First I defined these macros:
#define CONCAT(a,b) a##b #define STRINGIZE_(x) #x #define STRINGIZE(x) STRINGIZE_(x)
then inside the dialog entry:
... EXSTYLE WS_EX_APPWINDOW CAPTION STRINGIZE(CONCAT(Hello,World)) FONT 10, "Segoe UI Semibold", 600, 0, 0x0 ...
In this case, the title of the dialog box looks like HelloWorld - without any stray quotes or anything else. Hope you can use this technique.
source share