March 22, 2005
Ryan

I've finally incorporated this. Sorry for the delay.

It'll be in 1.8.3 beta5, which will probably be sometime this week or next. When you get a chance, it'd be great if you can check it out on 9x. I've tested it by 'pretenting' to be 9x on XP, but some finite doubt remains until it's tested on a real 9x system.

Thanks again for the insight. I've mentioned you in the (winstl_resource_string.h) file header, and also in the Doxygen stuff. I've amended the copyright to now say:

 * Home:        http://stlsoft.org/
 *
 * Copyright 1994-2005, Matthew Wilson and Synesis Software
 * Copyright 2004-2005, Ryan Ginstrom


Cheers, and thanks again

Matthew


"Ryan Ginstrom" <ryan@ginstrom.com> wrote in message news:cpgjpd$11ps$1@digitaldaemon.com...
>I have just starting using stlsoft, and I like it a lot.
>
> A note about basic_resource_string, though.
>
> The Unicode version uses LoadStringW, but that function does not work on Win9x.
>
> Below my sig is a method I use to ensure that retrieving resource strings as Unicode works on Win9x platforms, adapted from an MSDN example.
>
> -- 
> Regards,
> Ryan Ginstrom
> ryang@gol.com
>
> // Function name : resource2wstring
> // Description     : LoadStringW returns NULL on Win9x, so we need this
> workaround
> inline wstring resource2wstring( const UINT uid, const HINSTANCE instance )
> {
> UINT block = (uid >> 4) + 1;   // Compute block number.
> UINT num = uid & 0xf;      // Compute offset into block.
>
> HRSRC hRC = FindResourceEx( instance,
>  RT_STRING,
>  MAKEINTRESOURCE(block),
>  MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL));
>
> if ( hRC == NULL )
>  return wstring() ;
>
> HGLOBAL hgl = LoadResource(instance, hRC);
>
> if ( hgl == NULL )
>  return wstring() ;
>
> LPWSTR res_str = (LPWSTR)LockResource(hgl);
>
> if ( res_str == NULL )
>  return wstring() ;
>
> for ( UINT i = 0; i < num; i++)
> {
>  res_str += *res_str + 1;
> }
>
> return wstring( res_str + 1,  *res_str );
> }
> 


1 2
Next ›   Last »