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.

141 lines
3.1 KiB

  1. //
  2. // C O N F G D L G . C P P
  3. //
  4. // Dialog box handling for Server configuration
  5. //
  6. // Author: danielwe
  7. // Created: 5 Mar 1997
  8. //
  9. #include "pch.h"
  10. #pragma hdrstop
  11. #include "resource.h"
  12. #include "srvrdlg.h"
  13. #include "srvrhlp.h"
  14. extern const WCHAR c_szNetCfgHelpFile[];
  15. LRESULT CServerConfigDlg::OnInitDialog(UINT uMsg, WPARAM wParam,
  16. LPARAM lParam, BOOL& bHandled)
  17. {
  18. const SERVER_DLG_DATA * psdd;
  19. INT idd = 0;
  20. psdd = m_psc->DlgData();
  21. Assert(psdd);
  22. switch (psdd->dwSize)
  23. {
  24. case 1:
  25. idd = RDB_Minimize;
  26. break;
  27. case 2:
  28. idd = RDB_Balance;
  29. break;
  30. case 3:
  31. if (psdd->fLargeCache)
  32. {
  33. idd = RDB_FileSharing;
  34. }
  35. else
  36. {
  37. idd = RDB_NetApps;
  38. }
  39. break;
  40. default:
  41. AssertSz(FALSE, "Invalid Size parameter!");
  42. break;
  43. }
  44. CheckDlgButton(idd, TRUE);
  45. CheckDlgButton(CHK_Announce, psdd->fAnnounce);
  46. return TRUE;
  47. }
  48. LRESULT CServerConfigDlg::OnOk(int idCtrl, LPNMHDR pnmh, BOOL& bHandled)
  49. {
  50. SERVER_DLG_DATA * psdd;
  51. static const INT aidd[] =
  52. {
  53. RDB_Minimize,
  54. RDB_Balance,
  55. RDB_FileSharing,
  56. RDB_NetApps,
  57. };
  58. static const INT cidd = celems(aidd);
  59. INT iidd;
  60. psdd = m_psc->DlgDataRW();
  61. Assert(psdd);
  62. // figure out which radio button was selected
  63. for (iidd = 0; iidd < cidd; iidd++)
  64. {
  65. if (IsDlgButtonChecked(aidd[iidd]))
  66. break;
  67. }
  68. AssertSz(iidd < cidd, "Umm. How could a button NOT be selected??");
  69. // make it 1-based instead of 0-based
  70. iidd++;
  71. psdd->fLargeCache = (iidd == 3);
  72. psdd->dwSize = min(iidd, 3);
  73. psdd->fAnnounce = IsDlgButtonChecked(CHK_Announce);
  74. m_psc->SetDirty();
  75. return 0;
  76. }
  77. //+---------------------------------------------------------------------------
  78. //
  79. // Method: CServerConfigDlg::OnContextMenu
  80. //
  81. // Desc: Bring up context-sensitive help
  82. //
  83. // Args: Standard command parameters
  84. //
  85. // Return: LRESULT
  86. //
  87. LRESULT
  88. CServerConfigDlg::OnContextMenu(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled)
  89. {
  90. if (g_aHelpIDs_DLG_ServerConfig != NULL)
  91. {
  92. ::WinHelp(m_hWnd,
  93. c_szNetCfgHelpFile,
  94. HELP_CONTEXTMENU,
  95. (ULONG_PTR)g_aHelpIDs_DLG_ServerConfig);
  96. }
  97. return 0;
  98. }
  99. //+---------------------------------------------------------------------------
  100. //
  101. // Method: CServerConfigDlg::OnHelp
  102. //
  103. // Desc: Bring up context-sensitive help when dragging ? icon over a control
  104. //
  105. // Args: Standard command parameters
  106. //
  107. // Return: LRESULT
  108. //
  109. //
  110. LRESULT
  111. CServerConfigDlg::OnHelp(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& fHandled)
  112. {
  113. LPHELPINFO lphi = reinterpret_cast<LPHELPINFO>(lParam);
  114. Assert(lphi);
  115. if ((g_aHelpIDs_DLG_ServerConfig != NULL) && (HELPINFO_WINDOW == lphi->iContextType))
  116. {
  117. ::WinHelp(static_cast<HWND>(lphi->hItemHandle),
  118. c_szNetCfgHelpFile,
  119. HELP_WM_HELP,
  120. (ULONG_PTR)g_aHelpIDs_DLG_ServerConfig);
  121. }
  122. return 0;
  123. }