visual studio 2010 - Concatenate string and constant in resource file in C++ (MFC) -
i have c++ project mfc , resource file. in about-dialog want add constant contains version of programm.
idd_aboutbox dialog discardable 34, 22, 237, 65 style ds_modalframe | ws_popup | ws_caption | ws_sysmenu caption "about monitor" font 8, "ms sans serif" begin icon idr_mainframe, idc_static, 11, 22, 20, 20 #ifdef __64bit__ ltext "communication monitor v" app_version " x86_64", idc_static, 40, 13, 150, 8 #else ltext "communication monitor v" app_version " x86_32", idc_static, 40, 13, 150, 8 #endif //__64bit__ defpushbutton "ok", idok, 200, 6, 32, 14 end
if looks error
1>src\monitor.rc(80): error rc2116: expecting number id 1>src\monitor.rc(80): error rc2108: expected numerical dialog constant
i tried concatenate +
idd_aboutbox dialog discardable 34, 22, 237, 65 style ds_modalframe | ws_popup | ws_caption | ws_sysmenu caption "about monitor" font 8, "ms sans serif" begin icon idr_mainframe, idc_static, 11, 22, 20, 20 #ifdef __64bit__ ltext "communication monitor v" + app_version + " x86_64", idc_static, 40, 13, 150, 8 #else ltext "communication monitor v" + app_version + " x86_32", idc_static, 40, 13, 150, 8 #endif //__64bit__ defpushbutton "ok", idok, 200, 6, 32, 14 end
but error
1>src\monitor.rc(80): error rc2237: numeric value expected @ 3.1.4.1
my next try call function defined @ top of rc-file
error both above.
is possible concatenate string , variable in rc-file within ltext?
#define hstr( n ) #n #define str( n ) hstr( n ) #define ver_txt( n ) communication monitor v##n x86_32 #define ver_str( n ) str( ver_txt( n ) )
works on vs2013. should work on vs2010, too.
Comments
Post a Comment