At the moment I’m developing a windows service in C++ using the winapi and boost. Because it’s a good style not to write strings in the source code (like “Service is started.”) and because of the aspect of internationalization I’m looking after a technique to manage the messages/captions of my application.
I found an code project article which describes the usage of the message compiler (mc.exe) in combination with resource files. But this way looks a little bit uncommon. The author wrote that the message compiler is a seldom used tool and the article is also pretty old. Because of that I would like to ask what’s a modern way managing strings in a project which only relies on the windows API and boost.
I hope somebody could give me a hint.
For Windows applications, I suggest good old fashioned STRINGTABLEs in resource files, and using the LoadString() API.
Services can also make use of the above, with a notable exception. If your service needs to post messages to the Windows Event Log, then you’ll need to use the message compiler to store such messages/format strings in your application as a resource. This article (while terse) contains a summary of what needs to be done to support this.