On Thu, Sep 17, 2009 at 6:34 AM, Henri Verbeet hverbeet@gmail.com wrote:
2009/9/17 Brian Nguyen mtxcoll@gmail.com:
+/* Thread-safe function for converting to wide char strings at runtime */ +LPWSTR PrintWide(LPWSTR buf, size_t len, const char *s) +{
- size_t i;
- for (i = 0; i < len && *s != '\0'; i++, s++) {
- buf[i] = *s;
- }
- return buf;
+}
That doesn't do what you want, you should use MultiByteToWideChar() to convert to WCHAR. However, I don't think you want to hardcode the strings in the first place, you should load them from the resources so they can be translated. Also, functions like that which are only used in the current file should be static.
Thanks for taking this on!