Reputation: 139
If I open a resource file (*.rc) in Visual Studio (2010 - 2019) the Visual Designer opens. If I now save the file all whitespaces after a comma are removed... also some code snippets with "#ifdef Win32" are removed.
Before
// English (U.S.) resources
#if !defined(RESOURCE_DLL) || defined(ARG_ENU)
#ifdef _WIN32
#pragma code_page(12)
#endif //_WIN32
LTEXT "some text", IDC_PREFS, 5, 41, 137, 8
After Before
// English (United States) resources
#if !defined(RESOURCE_DLL) || defined(ARG_ENU)
#pragma code_page(12)
LTEXT "some text",IDC_PREFS,5,41,137,8
How can I change this auto-edit in C++?
Upvotes: 0
Views: 72
Reputation: 16779
RC file is under control of the Visual Studio. It is parsed by the IDE, and it is automatically written by the IDE. If you change something in it by hand, you are just hoping that IDE will parse correctly your changes (it will most of the time), but you have no control over how IDE will write the file when you change something within the RC editor.
Same thing applies to disappearing #ifdef _WIN32
. IDE writes its thing how it writes it. You have no control over it. The rest is just speculation, but now you maybe have the Unicode problem in RC. If I recall correctly, to fix this problem open the RC file in text editor (right click > View Code), and then save it as Unicode (File > Save As > instead of "Save" button pick "Save With Encoding" from drop down button list > choose Unicode - Codepage 1200). From that moment forward you will be able to write Unicode from within the RC editor.
Upvotes: 4