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.

170 lines
3.2 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows NT **/
  3. /** Copyright(c) Microsoft Corp., 1991 **/
  4. /**********************************************************************/
  5. /*
  6. srvname.cxx
  7. This file contains the definition of CHANGE_SERVER_NAME_DLG.
  8. History:
  9. NarenG 12/15/92 Created.
  10. */
  11. #define INCL_WINDOWS_GDI
  12. #define INCL_WINDOWS
  13. #define INCL_DOSERRORS
  14. #define INCL_NETERRORS
  15. #define INCL_NETSHARE
  16. #define INCL_NETSERVER
  17. #define INCL_NETCONS
  18. #define INCL_NETLIB
  19. #include <lmui.hxx>
  20. #define INCL_BLT_WINDOW
  21. #define INCL_BLT_DIALOG
  22. #define INCL_BLT_CONTROL
  23. #define INCL_BLT_MISC
  24. #define INCL_BLT_CLIENT
  25. #define INCL_BLT_MSGPOPUP
  26. #define INCL_BLT_SPIN_GROUP
  27. #define INCL_BLT_GROUP
  28. #include <blt.hxx>
  29. extern "C"
  30. {
  31. #include <afpmgr.h>
  32. #include <macfile.h>
  33. }
  34. #include <string.hxx>
  35. #include <uitrace.hxx>
  36. #include <dbgstr.hxx>
  37. #include <netname.hxx>
  38. #include "srvname.hxx"
  39. /*******************************************************************
  40. NAME: CHANGE_SERVER_NAME_DLG::CHANGE_SERVER_NAME_DLG
  41. SYNOPSIS: Constructor for SERVER_PARAMETERS_DIALOG class
  42. ENTRY: hwndParent - handle of parent window
  43. EXIT:
  44. RETURNS:
  45. NOTES:
  46. HISTORY:
  47. NarenG 12/15/92 Created
  48. ********************************************************************/
  49. CHANGE_SERVER_NAME_DLG :: CHANGE_SERVER_NAME_DLG(
  50. HWND hwndParent,
  51. NLS_STR *pnlsServerName )
  52. : DIALOG_WINDOW( MAKEINTRESOURCE( IDD_CHANGE_SERVERNAME_DIALOG ),
  53. hwndParent ),
  54. _sleServerName( this, IDCS_SLE_SERVER_NAME, AFP_SERVERNAME_LEN ),
  55. _pnlsServerName( pnlsServerName )
  56. {
  57. //
  58. // Make sure everything constructed OK
  59. //
  60. if ( QueryError() != NERR_Success )
  61. return;
  62. APIERR err;
  63. if ( (err = _sleServerName.QueryError()) != NERR_Success )
  64. {
  65. ReportError( err );
  66. return;
  67. }
  68. _sleServerName.SetText( *pnlsServerName );
  69. _sleServerName.ClaimFocus();
  70. }
  71. /*******************************************************************
  72. NAME: CHANGE_SERVER_NAME_DLG::OnOK
  73. SYNOPSIS:
  74. ENTRY:
  75. EXIT:
  76. RETURNS:
  77. NOTES:
  78. HISTORY:
  79. NarenG 12/15/92 Created
  80. ********************************************************************/
  81. BOOL CHANGE_SERVER_NAME_DLG :: OnOK( VOID )
  82. {
  83. _sleServerName.QueryText( _pnlsServerName );
  84. if ( _pnlsServerName->QueryTextLength() == 0 )
  85. {
  86. ::MsgPopup( this, IDS_NEED_SERVER_NAME );
  87. _sleServerName.ClaimFocus();
  88. return FALSE;
  89. }
  90. //
  91. // Validate the server name
  92. //
  93. ISTR istr( *_pnlsServerName );
  94. if ( _pnlsServerName->strchr( &istr, TEXT(':') ) )
  95. {
  96. ::MsgPopup( this, IDS_AFPERR_InvalidServerName );
  97. _sleServerName.ClaimFocus();
  98. return FALSE;
  99. }
  100. Dismiss( TRUE );
  101. return TRUE;
  102. }
  103. /*******************************************************************
  104. NAME: CHANGE_SERVER_NAME_DLG::QueryHelpContext
  105. SYNOPSIS: Query the help context of the dialog
  106. ENTRY:
  107. EXIT:
  108. RETURNS: Return the help context of the dialog
  109. NOTES:
  110. HISTORY:
  111. NarenG 12/15/92 Created
  112. ********************************************************************/
  113. ULONG CHANGE_SERVER_NAME_DLG::QueryHelpContext( VOID )
  114. {
  115. return HC_CHANGE_SERVER_NAME_DLG;
  116. }