"Hans Leidekker" hans@it.vu.nl wrote:
+static const char *errorstring[] = {
- "Success",
...
+static const WCHAR error00[] = { 'S','u','c','c','e','s','s',0 };
I'd suggest to move all strings into a stringtable and load them by LoadStringA/W. That way you get internationalization for free.
On Friday 29 July 2005 14:45, Dmitry Timoshkov wrote:
I'd suggest to move all strings into a stringtable and load them by LoadStringA/W. That way you get internationalization for free.
But according MSDN:
The return value is a static pointer to the character string. Do not free this string.
How would you handle this using LoadString?
-Hans
On 29.07.2005 15:23, Hans Leidekker wrote:
On Friday 29 July 2005 14:45, Dmitry Timoshkov wrote:
I'd suggest to move all strings into a stringtable and load them by LoadStringA/W. That way you get internationalization for free.
But according MSDN:
The return value is a static pointer to the character string. Do not free this string.
How would you handle this using LoadString?
Hm, perhaps load all strings at DLL init time and free them when the DLL gets unloaded again?
-f.r.
"Hans Leidekker" hans@it.vu.nl wrote:
But according MSDN:
The return value is a static pointer to the character string. Do not free this string.
How would you handle this using LoadString?
Something like this:
PCHAR ldap_err2stringA( ULONG err ) { static char buf[256];
if (!LoadStringA(wldap_hinst, err, buf, 256)) LoadStringA(wldap_hinst, IDS_DEFAULT_ERROR, buf, 256);
return buf; }
PWCHAR ldap_err2stringW( ULONG err ) { static WCHAR buf[256];
if (!LoadStringW(wldap_hinst, err, buf, 256)) LoadStringW(wldap_hinst, IDS_DEFAULT_ERROR, buf, 256);
return buf; }
On Friday 29 July 2005 15:55, Dmitry Timoshkov wrote:
How would you handle this using LoadString?
Something like this:
PCHAR ldap_err2stringA( ULONG err ) { static char buf[256];
if (!LoadStringA(wldap_hinst, err, buf, 256)) LoadStringA(wldap_hinst, IDS_DEFAULT_ERROR, buf, 256); return buf;
}
Thanks, that looks reasonable. Now let's see if I can learn how to do resource files...
-Hans