Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
1.3 KiB

  1. //+---------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997-1998.
  5. //
  6. // File: StrRes.hxx
  7. //
  8. // Contents: Dynamically loadable string resource.
  9. //
  10. // Classes: StringResource
  11. //
  12. // History: 26-Jun-1998 KyleP Added header
  13. //
  14. //----------------------------------------------------------------------------
  15. #pragma once
  16. #include <dynload.hxx>
  17. DeclDynLoad( User32,
  18. LoadStringW,
  19. int,
  20. WINAPI,
  21. ( HINSTANCE hInstance, UINT uID, LPWSTR lpBuffer, int nBufferMax),
  22. ( hInstance, uID, lpBuffer, nBufferMax) );
  23. union StringResource
  24. {
  25. int idString;
  26. WCHAR wsz[250];
  27. void Init( HINSTANCE hInstance )
  28. {
  29. if ( 0 == LoadString( hInstance, idString, wsz, sizeof(wsz) / sizeof(WCHAR) ) )
  30. {
  31. Win4Assert( !"LoadString failed!" );
  32. wsz[0] = 0;
  33. }
  34. }
  35. void Init( HINSTANCE hInstance, CDynLoadUser32 & dlUser32 )
  36. {
  37. if ( 0 == dlUser32.LoadString( hInstance, idString, wsz, sizeof(wsz) / sizeof(WCHAR) ) )
  38. {
  39. Win4Assert( !"LoadString failed!" );
  40. wsz[0] = 0;
  41. }
  42. }
  43. };
  44. #define STRINGRESOURCE( sr ) (WCHAR *)&sr