29 Jul
2005
29 Jul
'05
1:55 p.m.
"Hans Leidekker" <hans(a)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; } -- Dmitry.