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.

127 lines
2.7 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. util.cxx
  7. Utility functions used by the SFMMGR UI.
  8. 1) SetCaption method.
  9. FILE HISTORY:
  10. NarenG 27-Dec-1992 Created.
  11. */
  12. #define INCL_NET
  13. #define INCL_WINDOWS
  14. #define INCL_WINDOWS_GDI
  15. #define INCL_NETERRORS
  16. #define INCL_DOSERRORS
  17. #define INCL_NETLIB
  18. #include <lmui.hxx>
  19. #define INCL_BLT_WINDOW
  20. #define INCL_BLT_DIALOG
  21. #define INCL_BLT_CONTROL
  22. #define INCL_BLT_MISC
  23. #define INCL_BLT_CLIENT
  24. #include <blt.hxx>
  25. #include "util.hxx"
  26. /*******************************************************************
  27. NAME: SetCaption
  28. SYNOPSIS: Sets the dialog caption to "Foo on Server".
  29. ENTRY: powin - The dialog window.
  30. idCaption - Resource ID for the caption
  31. string (for example,
  32. "Open Resources on %1").
  33. pszServerName - The server name, if this is NULL
  34. it will be assumed that there is no
  35. insert string.
  36. EXIT: The caption is set.
  37. RETURNS: APIERR - Any error encountered.
  38. NOTES:
  39. HISTORY:
  40. NarenG 22-Sep-1992 Created.
  41. ********************************************************************/
  42. APIERR SetCaption( OWNER_WINDOW * powin,
  43. UINT idCaption,
  44. const TCHAR * pszServerName )
  45. {
  46. //
  47. // This will (eventually...) receive the caption string.
  48. //
  49. NLS_STR nlsCaption;
  50. APIERR err;
  51. if ( ( ( err = nlsCaption.QueryError() ) != NERR_Success ) ||
  52. ( ( err = nlsCaption.Load( idCaption ) ) != NERR_Success ) )
  53. {
  54. return err;
  55. }
  56. if ( pszServerName != NULL )
  57. {
  58. //
  59. // Note that the server name still has the leading
  60. // backslashes (\\). They are not to be displayed.
  61. //
  62. ALIAS_STR nlsServerName( pszServerName );
  63. ISTR istr( nlsServerName );
  64. //
  65. // Skip the backslashes.
  66. //
  67. istr += 2;
  68. ALIAS_STR nlsWithoutPrefix( nlsServerName.QueryPch( istr ) );
  69. //
  70. // The insert strings for Load().
  71. //
  72. nlsCaption.InsertParams( nlsWithoutPrefix );
  73. if( !nlsCaption )
  74. {
  75. return nlsCaption.QueryError();
  76. }
  77. }
  78. //
  79. // Set the caption.
  80. //
  81. powin->SetText( nlsCaption.QueryPch() );
  82. //
  83. // Success!
  84. //
  85. return NERR_Success;
  86. }