Jump to page: 1 2
Thread overview
resource_string
May 21, 2004
Pablo Aguilar
May 21, 2004
Matthew
May 21, 2004
Matthew
May 21, 2004
Pablo Aguilar
May 22, 2004
Matthew
Dec 12, 2004
Ryan Ginstrom
Dec 12, 2004
Matthew
Dec 12, 2004
Ryan Ginstrom
Dec 13, 2004
Matthew
Dec 13, 2004
Ryan Ginstrom
Mar 22, 2005
Matthew
May 21, 2004
Is there or will there be a resource_string that's not dependant on MFC?


May 21, 2004
There's basic_resource_string in winstl_resource_string.h, which is in the inprogress directory. I've been using this myself a lot recently (in the shell extensions just updated at http://shellext.com) and will promote this to the main directory for 1.7.1.

It requires a base string to use, e.g. std::string, and you can supply an exception policy type (otherwise it uses stlsoft::null_exception, which does not throw, and the string is just empty on failure).

Beware that it does not yet work for UNICODE, but I will make this work before 1.7.1 (which I am hoping to release in the next few days ...).

Good reminder! :-)

"Pablo Aguilar" <paguilarg@hotmail.com> wrote in message news:c8lk6v$r7m$1@digitaldaemon.com...
> Is there or will there be a resource_string that's not dependant on MFC?
>
>



May 21, 2004
I've done it, and added in unit testing (and tested it!). Here's a sneak preview.

Note: It does work with UNICODE. I was blowing hot air. ;)

"Matthew" <matthew.hat@stlsoft.dot.org> wrote in message news:c8lnhp$10ei$1@digitaldaemon.com...
> There's basic_resource_string in winstl_resource_string.h, which is in the inprogress directory. I've been using this myself a lot recently (in the shell extensions just updated at http://shellext.com) and will promote this to the
main
> directory for 1.7.1.
>
> It requires a base string to use, e.g. std::string, and you can supply an exception policy type (otherwise it uses stlsoft::null_exception, which does
not
> throw, and the string is just empty on failure).
>
> Beware that it does not yet work for UNICODE, but I will make this work before 1.7.1 (which I am hoping to release in the next few days ...).
>
> Good reminder! :-)
>
> "Pablo Aguilar" <paguilarg@hotmail.com> wrote in message news:c8lk6v$r7m$1@digitaldaemon.com...
> > Is there or will there be a resource_string that's not dependant on MFC?
> >
> >
>
>
>



May 21, 2004
Thanks!

I've just recently decided not to hard code strings anymore, and this is coming in real handy...

> I've done it, and added in unit testing (and tested it!). Here's a sneak
preview.
>
> Note: It does work with UNICODE. I was blowing hot air. ;)


May 22, 2004
Pleasure. :)

"Pablo Aguilar" <paguilarg@hotmail.com> wrote in message news:c8ludf$1ar7$1@digitaldaemon.com...
> Thanks!
>
> I've just recently decided not to hard code strings anymore, and this is coming in real handy...
>
> > I've done it, and added in unit testing (and tested it!). Here's a sneak
> preview.
> >
> > Note: It does work with UNICODE. I was blowing hot air. ;)
>
>


December 12, 2004
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 );
}

December 12, 2004
"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.

Great!

May I ask how/from whom you heard about it?

> 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.

Ok. I'll check it out, and have a think about it.

Assuming it's the go, how would you feel about my incorporating this into a future release? Naturally your input would be suitably credited.

Cheers

Matthew


> 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 );
> }
>


December 12, 2004
"Matthew" <admin@stlsoft.dot.dot.dot.dot.org> wrote in message news:cpidmd$2sut$1@digitaldaemon.com...
>
> "Ryan Ginstrom" <ryan@ginstrom.com> wrote in message
> > I have just starting using stlsoft, and I like it a lot.
>
> May I ask how/from whom you heard about it?

I actually heard about stlsoft a while ago (I have version 1.6.5 sitting on my hard disk), but just recently started using it after reading your description of it in your article on C# performance. That article spurred me to take a closer look at the library, and I'm very glad I did. There is lots of great stuff in there, and it actually works! <g>

> > 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.
>
> Ok. I'll check it out, and have a think about it.
>
> Assuming it's the go, how would you feel about my incorporating this into a future release? Naturally your input would be suitably credited.

I don't mind all, but as I mentioned it is adapted from an MSDN example, not original.

-- 
Regards,
Ryan Ginstrom
ryang@gol.com

December 13, 2004
"Ryan Ginstrom" <ryan@ginstrom.com> wrote in message news:cpii35$30mp$1@digitaldaemon.com...
> "Matthew" <admin@stlsoft.dot.dot.dot.dot.org> wrote in message news:cpidmd$2sut$1@digitaldaemon.com...
>>
>> "Ryan Ginstrom" <ryan@ginstrom.com> wrote in message
>> > I have just starting using stlsoft, and I like it a lot.
>>
>> May I ask how/from whom you heard about it?
>
> I actually heard about stlsoft a while ago (I have version 1.6.5 sitting on my hard disk), but just recently started using it after reading your description of it in your article on C# performance. That article spurred me to take a closer look at the library, and I'm very glad I did. There is lots of great stuff in there, and it actually works! <g>

Well, that's because I use it a lot, I guess. It's a much easier task to create a library that works when its author uses it. ;-)

The one Achilles heal for STLSoft is the lamentable documentation. I am hoping to get time to address that soon, but it's always dragging behind new components, and new sub-projects (of which I have three planned for release soon: ACESTL, DbSTL, XMLSTL)

>> > 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.
>>
>> Ok. I'll check it out, and have a think about it.
>>
>> Assuming it's the go, how would you feel about my incorporating this into a future release? Naturally your input would be suitably credited.
>
> I don't mind all, but as I mentioned it is adapted from an MSDN example, not original.

Understood.

Thanks again. Feel free to post requests/bugs/criticisms here, or email them to me directly.

Cheers

Matthew


December 13, 2004
"Matthew" <admin.hat@stlsoft.dot.org> wrote in message news:cpin60$4mg$1@digitaldaemon.com...
> The one Achilles heal for STLSoft is the lamentable documentation. I am
hoping to get time to address that soon, but
> it's always dragging behind new components, and new sub-projects (of which
I have three planned for release soon:
> ACESTL, DbSTL, XMLSTL)

Documentation would be nice (as would a good XML parser/writer). I am no one to talk though, being rather poor at writing documentation myself.

Luckily though, the various classes can generally just be dropped in and used without too much fuss. I just checked out the resource_string implementation because I have been bitten by this problem before.

-- 
Regards,
Ryan Ginstrom
ryang@gol.com

« First   ‹ Prev
1 2