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.

2131 lines
64 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1996-2000 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // ResProp.cpp
  7. //
  8. // Abstract:
  9. // Implementation of the resource property sheet and pages.
  10. //
  11. // Author:
  12. // David Potter (davidp) May 16, 1996
  13. //
  14. // Revision History:
  15. //
  16. // Notes:
  17. //
  18. /////////////////////////////////////////////////////////////////////////////
  19. #include "stdafx.h"
  20. #include "CluAdmin.h"
  21. #include "ConstDef.h"
  22. #include "ResProp.h"
  23. #include "Res.h"
  24. #include "ClusDoc.h"
  25. #include "Cluster.h"
  26. #include "ModNodes.h"
  27. #include "ModRes.h"
  28. #include "DDxDDv.h"
  29. #include "HelpData.h"
  30. #include "ExcOper.h"
  31. #include "resource.h"
  32. #ifdef _DEBUG
  33. #define new DEBUG_NEW
  34. #undef THIS_FILE
  35. static char THIS_FILE[] = __FILE__;
  36. #endif
  37. /////////////////////////////////////////////////////////////////////////////
  38. // CResourcePropSheet
  39. /////////////////////////////////////////////////////////////////////////////
  40. IMPLEMENT_DYNAMIC(CResourcePropSheet, CBasePropertySheet)
  41. /////////////////////////////////////////////////////////////////////////////
  42. // Message Maps
  43. BEGIN_MESSAGE_MAP(CResourcePropSheet, CBasePropertySheet)
  44. //{{AFX_MSG_MAP(CResourcePropSheet)
  45. //}}AFX_MSG_MAP
  46. END_MESSAGE_MAP()
  47. /////////////////////////////////////////////////////////////////////////////
  48. //++
  49. //
  50. // CResourcePropSheet::CResourcePropSheet
  51. //
  52. // Routine Description:
  53. // Constructor.
  54. //
  55. // Arguments:
  56. // pParentWnd [IN OUT] Parent window for this property sheet.
  57. // iSelectPage [IN] Page to show first.
  58. //
  59. // Return Value:
  60. // None.
  61. //
  62. //--
  63. /////////////////////////////////////////////////////////////////////////////
  64. CResourcePropSheet::CResourcePropSheet(
  65. IN OUT CWnd * pParentWnd,
  66. IN UINT iSelectPage
  67. )
  68. : CBasePropertySheet(pParentWnd, iSelectPage)
  69. {
  70. m_rgpages[0] = &PageGeneral();
  71. m_rgpages[1] = &PageDepends();
  72. m_rgpages[2] = &PageAdvanced();
  73. } //*** CResourcePropSheet::CResourcePropSheet()
  74. /////////////////////////////////////////////////////////////////////////////
  75. //++
  76. //
  77. // CResourcePropSheet::BInit
  78. //
  79. // Routine Description:
  80. // Initialize the property sheet.
  81. //
  82. // Arguments:
  83. // pci [IN OUT] Cluster item whose properties are to be displayed.
  84. // iimgIcon [IN] Index in the large image list for the image to use
  85. // as the icon on each page.
  86. //
  87. // Return Value:
  88. // TRUE Property sheet initialized successfully.
  89. // FALSE Error initializing property sheet.
  90. //
  91. //--
  92. /////////////////////////////////////////////////////////////////////////////
  93. BOOL CResourcePropSheet::BInit(
  94. IN OUT CClusterItem * pci,
  95. IN IIMG iimgIcon
  96. )
  97. {
  98. // Call the base class method.
  99. if (!CBasePropertySheet::BInit(pci, iimgIcon))
  100. return FALSE;
  101. // Set the read-only flag if the handles are invalid.
  102. m_bReadOnly = PciRes()->BReadOnly()
  103. || (PciRes()->Crs() == ClusterResourceStateUnknown);
  104. SetPfGetResNetName(CResourceDependsPage::BGetNetworkName, &PageDepends());
  105. return TRUE;
  106. } //*** CResourcePropSheet::BInit()
  107. /////////////////////////////////////////////////////////////////////////////
  108. //++
  109. //
  110. // CResourcePropSheet::Ppages
  111. //
  112. // Routine Description:
  113. // Returns the array of pages to add to the property sheet.
  114. //
  115. // Arguments:
  116. // None.
  117. //
  118. // Return Value:
  119. // Page array.
  120. //
  121. //--
  122. /////////////////////////////////////////////////////////////////////////////
  123. CBasePropertyPage ** CResourcePropSheet::Ppages(void)
  124. {
  125. return m_rgpages;
  126. } //*** CResourcePropSheet::Pppges()
  127. /////////////////////////////////////////////////////////////////////////////
  128. //++
  129. //
  130. // CResourcePropSheet::Cpages
  131. //
  132. // Routine Description:
  133. // Returns the count of pages in the array.
  134. //
  135. // Arguments:
  136. // None.
  137. //
  138. // Return Value:
  139. // Count of pages in the array.
  140. //
  141. //--
  142. /////////////////////////////////////////////////////////////////////////////
  143. int CResourcePropSheet::Cpages(void)
  144. {
  145. return sizeof(m_rgpages) / sizeof(CBasePropertyPage *);
  146. } //*** CResourcePropSheet::Cpages()
  147. //*************************************************************************//
  148. /////////////////////////////////////////////////////////////////////////////
  149. // CResourceGeneralPage property page
  150. /////////////////////////////////////////////////////////////////////////////
  151. IMPLEMENT_DYNCREATE(CResourceGeneralPage, CBasePropertyPage)
  152. /////////////////////////////////////////////////////////////////////////////
  153. // Message Maps
  154. BEGIN_MESSAGE_MAP(CResourceGeneralPage, CBasePropertyPage)
  155. //{{AFX_MSG_MAP(CResourceGeneralPage)
  156. ON_BN_CLICKED(IDC_PP_RES_POSSIBLE_OWNERS_MODIFY, OnModifyPossibleOwners)
  157. ON_LBN_DBLCLK(IDC_PP_RES_POSSIBLE_OWNERS, OnDblClkPossibleOwners)
  158. ON_WM_CONTEXTMENU()
  159. //}}AFX_MSG_MAP
  160. ON_EN_CHANGE(IDC_PP_RES_NAME, CBasePropertyPage::OnChangeCtrl)
  161. ON_EN_CHANGE(IDC_PP_RES_DESC, CBasePropertyPage::OnChangeCtrl)
  162. ON_BN_CLICKED(IDC_PP_RES_SEPARATE_MONITOR, CBasePropertyPage::OnChangeCtrl)
  163. ON_COMMAND(ID_FILE_PROPERTIES, OnProperties)
  164. END_MESSAGE_MAP()
  165. /////////////////////////////////////////////////////////////////////////////
  166. //++
  167. //
  168. // CResourceGeneralPage::CResourceGeneralPage
  169. //
  170. // Routine Description:
  171. // Constructor.
  172. //
  173. // Arguments:
  174. // None.
  175. //
  176. // Return Value:
  177. // None.
  178. //
  179. //--
  180. /////////////////////////////////////////////////////////////////////////////
  181. CResourceGeneralPage::CResourceGeneralPage(void)
  182. : CBasePropertyPage(IDD, g_aHelpIDs_IDD_PP_RES_GENERAL)
  183. {
  184. //{{AFX_DATA_INIT(CResourceGeneralPage)
  185. m_strName = _T("");
  186. m_strDesc = _T("");
  187. m_strGroup = _T("");
  188. m_strState = _T("");
  189. m_strNode = _T("");
  190. m_bSeparateMonitor = FALSE;
  191. //}}AFX_DATA_INIT
  192. } //*** CResourceGeneralPage::CResourceGeneralPage()
  193. /////////////////////////////////////////////////////////////////////////////
  194. //++
  195. //
  196. // CResourceGeneralPage::BInit
  197. //
  198. // Routine Description:
  199. // Initialize the page.
  200. //
  201. // Arguments:
  202. // psht [IN OUT] Property sheet to which this page belongs.
  203. //
  204. // Return Value:
  205. // TRUE Page initialized successfully.
  206. // FALSE Page failed to initialize.
  207. //
  208. //--
  209. /////////////////////////////////////////////////////////////////////////////
  210. BOOL CResourceGeneralPage::BInit(IN OUT CBaseSheet * psht)
  211. {
  212. BOOL bSuccess;
  213. ASSERT_KINDOF(CResourcePropSheet, psht);
  214. bSuccess = CBasePropertyPage::BInit(psht);
  215. if (bSuccess)
  216. {
  217. try
  218. {
  219. m_strName = PciRes()->StrName();
  220. m_strDesc = PciRes()->StrDescription();
  221. if (PciRes()->PciResourceType() != NULL)
  222. m_strType = PciRes()->PciResourceType()->StrDisplayName();
  223. m_strGroup = PciRes()->StrGroup();
  224. m_strNode = PciRes()->StrOwner();
  225. m_bSeparateMonitor = PciRes()->BSeparateMonitor();
  226. // Duplicate the possible owners list.
  227. {
  228. POSITION pos;
  229. CClusterNode * pciNode;
  230. pos = PciRes()->LpcinodePossibleOwners().GetHeadPosition();
  231. while (pos != NULL)
  232. {
  233. pciNode = (CClusterNode *) PciRes()->LpcinodePossibleOwners().GetNext(pos);
  234. ASSERT_VALID(pciNode);
  235. m_lpciPossibleOwners.AddTail(pciNode);
  236. } // while: more nodes in the list
  237. } // Duplicate the possible owners list
  238. PciRes()->GetStateName(m_strState);
  239. } // try
  240. catch (CException * pe)
  241. {
  242. pe->ReportError();
  243. pe->Delete();
  244. bSuccess = FALSE;
  245. } // catch: CException
  246. } // if: base class method was successful
  247. return bSuccess;
  248. } //*** CResourceGeneralPage::BInit()
  249. /////////////////////////////////////////////////////////////////////////////
  250. //++
  251. //
  252. // CResourceGeneralPage::DoDataExchange
  253. //
  254. // Routine Description:
  255. // Do data exchange between the dialog and the class.
  256. //
  257. // Arguments:
  258. // pDX [IN OUT] Data exchange object
  259. //
  260. // Return Value:
  261. // None.
  262. //
  263. //--
  264. /////////////////////////////////////////////////////////////////////////////
  265. void CResourceGeneralPage::DoDataExchange(CDataExchange * pDX)
  266. {
  267. CBasePropertyPage::DoDataExchange(pDX);
  268. //{{AFX_DATA_MAP(CResourceGeneralPage)
  269. DDX_Control(pDX, IDC_PP_RES_DESC, m_editDesc);
  270. DDX_Control(pDX, IDC_PP_RES_SEPARATE_MONITOR, m_ckbSeparateMonitor);
  271. DDX_Control(pDX, IDC_PP_RES_POSSIBLE_OWNERS_MODIFY, m_pbPossibleOwnersModify);
  272. DDX_Control(pDX, IDC_PP_RES_POSSIBLE_OWNERS, m_lbPossibleOwners);
  273. DDX_Control(pDX, IDC_PP_RES_NAME, m_editName);
  274. DDX_Text(pDX, IDC_PP_RES_NAME, m_strName);
  275. DDX_Text(pDX, IDC_PP_RES_DESC, m_strDesc);
  276. DDX_Text(pDX, IDC_PP_RES_RESOURCE_TYPE, m_strType);
  277. DDX_Text(pDX, IDC_PP_RES_GROUP, m_strGroup);
  278. DDX_Text(pDX, IDC_PP_RES_CURRENT_STATE, m_strState);
  279. DDX_Text(pDX, IDC_PP_RES_CURRENT_NODE, m_strNode);
  280. DDX_Check(pDX, IDC_PP_RES_SEPARATE_MONITOR, m_bSeparateMonitor);
  281. //}}AFX_DATA_MAP
  282. if (pDX->m_bSaveAndValidate)
  283. {
  284. if (!BReadOnly())
  285. {
  286. try
  287. {
  288. PciRes()->ValidateCommonProperties(
  289. m_strDesc,
  290. m_bSeparateMonitor,
  291. PciRes()->NLooksAlive(),
  292. PciRes()->NIsAlive(),
  293. PciRes()->CrraRestartAction(),
  294. PciRes()->NRestartThreshold(),
  295. PciRes()->NRestartPeriod(),
  296. PciRes()->NPendingTimeout()
  297. );
  298. } // try
  299. catch (CException * pe)
  300. {
  301. pe->ReportError();
  302. pe->Delete();
  303. pDX->Fail();
  304. } // catch: CException
  305. if ((LpciPossibleOwners().GetCount() == 0))
  306. {
  307. ID id = AfxMessageBox(IDS_NO_POSSIBLE_OWNERS_QUERY, MB_YESNO | MB_ICONWARNING);
  308. if (id == IDNO)
  309. pDX->Fail();
  310. } // if: no possible owners
  311. } // if: not read only
  312. } // if: saving data from the dialog
  313. else
  314. {
  315. FillPossibleOwners();
  316. } // else: setting data to the dialog
  317. } //*** CResourceGeneralPage::DoDataExchange()
  318. /////////////////////////////////////////////////////////////////////////////
  319. //++
  320. //
  321. // CResourceGeneralPage::FillPossibleOwners
  322. //
  323. // Routine Description:
  324. // Fill the Possible Owners list box.
  325. //
  326. // Arguments:
  327. // None.
  328. //
  329. // Return Value:
  330. // None.
  331. //
  332. //--
  333. /////////////////////////////////////////////////////////////////////////////
  334. void CResourceGeneralPage::FillPossibleOwners(void)
  335. {
  336. POSITION posPci;
  337. CClusterNode * pciNode;
  338. int iitem;
  339. m_lbPossibleOwners.ResetContent();
  340. posPci = LpciPossibleOwners().GetHeadPosition();
  341. while (posPci != NULL)
  342. {
  343. pciNode = (CClusterNode *) LpciPossibleOwners().GetNext(posPci);
  344. iitem = m_lbPossibleOwners.AddString(pciNode->StrName());
  345. if (iitem >= 0)
  346. m_lbPossibleOwners.SetItemDataPtr(iitem, pciNode);
  347. } // for: each string in the list
  348. } //*** CResourceGeneralPage::FillPossibleOwners()
  349. /////////////////////////////////////////////////////////////////////////////
  350. //++
  351. //
  352. // CResourceGeneralPage::OnInitDialog
  353. //
  354. // Routine Description:
  355. // Handler for the WM_INITDIALOG message.
  356. //
  357. // Arguments:
  358. // None.
  359. //
  360. // Return Value:
  361. // TRUE Focus needs to be set.
  362. // FALSE Focus already set.
  363. //
  364. //--
  365. /////////////////////////////////////////////////////////////////////////////
  366. BOOL CResourceGeneralPage::OnInitDialog(void)
  367. {
  368. CBasePropertyPage::OnInitDialog();
  369. // If read-only, set all controls to be either disabled or read-only.
  370. if (BReadOnly())
  371. {
  372. m_editName.SetReadOnly(TRUE);
  373. m_editDesc.SetReadOnly(TRUE);
  374. m_pbPossibleOwnersModify.EnableWindow(FALSE);
  375. m_ckbSeparateMonitor.EnableWindow(FALSE);
  376. } // if: sheet is read-only
  377. return TRUE; // return TRUE unless you set the focus to a control
  378. // EXCEPTION: OCX Property Pages should return FALSE
  379. } //*** CResourceGeneralPage::OnInitDialog()
  380. /////////////////////////////////////////////////////////////////////////////
  381. //++
  382. //
  383. // CResourceGeneralPage::OnApply
  384. //
  385. // Routine Description:
  386. // Handler for when the Apply button is pressed.
  387. //
  388. // Arguments:
  389. // None.
  390. //
  391. // Return Value:
  392. // TRUE Page successfully applied.
  393. // FALSE Error applying page.
  394. //
  395. //--
  396. /////////////////////////////////////////////////////////////////////////////
  397. BOOL CResourceGeneralPage::OnApply(void)
  398. {
  399. // Set the data from the page in the cluster item.
  400. try
  401. {
  402. CWaitCursor wc;
  403. PciRes()->SetName(m_strName);
  404. PciRes()->SetPossibleOwners(LpciPossibleOwners());
  405. PciRes()->SetCommonProperties(
  406. m_strDesc,
  407. m_bSeparateMonitor,
  408. PciRes()->NLooksAlive(),
  409. PciRes()->NIsAlive(),
  410. PciRes()->CrraRestartAction(),
  411. PciRes()->NRestartThreshold(),
  412. PciRes()->NRestartPeriod(),
  413. PciRes()->NPendingTimeout()
  414. );
  415. } // try
  416. catch (CNTException * pnte)
  417. {
  418. pnte->ReportError();
  419. pnte->Delete();
  420. if (pnte->Sc() != ERROR_RESOURCE_PROPERTIES_STORED)
  421. return FALSE;
  422. } // catch: CNTException
  423. catch (CException * pe)
  424. {
  425. pe->ReportError();
  426. pe->Delete();
  427. return FALSE;
  428. } // catch: CException
  429. return CBasePropertyPage::OnApply();
  430. } //*** CResourceGeneralPage::OnApply()
  431. /////////////////////////////////////////////////////////////////////////////
  432. //++
  433. //
  434. // CResourceGeneralPage::OnProperties
  435. //
  436. // Routine Description:
  437. // Handler for the BN_CLICKED message on the Properties button.
  438. //
  439. // Arguments:
  440. // None.
  441. //
  442. // Return Value:
  443. // None.
  444. //
  445. //--
  446. /////////////////////////////////////////////////////////////////////////////
  447. void CResourceGeneralPage::OnProperties(void)
  448. {
  449. int iitem;
  450. CClusterNode * pciNode;
  451. // Get the item with the focus.
  452. iitem = m_lbPossibleOwners.GetCurSel();
  453. ASSERT(iitem >= 0);
  454. if (iitem >= 0)
  455. {
  456. // Get the node pointer.
  457. pciNode = (CClusterNode *) m_lbPossibleOwners.GetItemDataPtr(iitem);
  458. ASSERT_VALID(pciNode);
  459. // Set properties of that item.
  460. if (pciNode->BDisplayProperties())
  461. {
  462. } // if: properties changed
  463. } // if: found an item with focus
  464. } //*** CResourceGeneralPage::OnProperties()
  465. /////////////////////////////////////////////////////////////////////////////
  466. //++
  467. //
  468. // CResourceGeneralPage::OnContextMenu
  469. //
  470. // Routine Description:
  471. // Handler for the WM_CONTEXTMENU method.
  472. //
  473. // Arguments:
  474. // pWnd Window in which the user right clicked the mouse.
  475. // point Position of the cursor, in screen coordinates.
  476. //
  477. // Return Value:
  478. // None.
  479. //
  480. //--
  481. /////////////////////////////////////////////////////////////////////////////
  482. void CResourceGeneralPage::OnContextMenu(CWnd * pWnd, CPoint point)
  483. {
  484. BOOL bHandled = FALSE;
  485. CMenu * pmenu = NULL;
  486. CListBox * pListBox = (CListBox *) pWnd;
  487. CString strMenuName;
  488. CWaitCursor wc;
  489. // If focus is not in the list control, don't handle the message.
  490. if ( pWnd == &m_lbPossibleOwners )
  491. {
  492. // Create the menu to display.
  493. try
  494. {
  495. pmenu = new CMenu;
  496. if ( pmenu == NULL )
  497. {
  498. AfxThrowMemoryException();
  499. } // if: error allocating the menu
  500. if ( pmenu->CreatePopupMenu() )
  501. {
  502. UINT nFlags = MF_STRING;
  503. // If there are no items in the list, disable the menu item.
  504. if ( pListBox->GetCount() == 0 )
  505. {
  506. nFlags |= MF_GRAYED;
  507. } // if: no items in the list
  508. // Add the Properties item to the menu.
  509. strMenuName.LoadString( IDS_MENU_PROPERTIES );
  510. if ( pmenu->AppendMenu( nFlags, ID_FILE_PROPERTIES, strMenuName ) )
  511. {
  512. bHandled = TRUE;
  513. if ( pListBox->GetCurSel() == -1 )
  514. {
  515. pListBox->SetCurSel( 0 );
  516. } // if: no items selected
  517. } // if: successfully added menu item
  518. } // if: menu created successfully
  519. } // try
  520. catch ( CException * pe )
  521. {
  522. pe->ReportError();
  523. pe->Delete();
  524. } // catch: CException
  525. } // if: focus is on list control
  526. if ( bHandled )
  527. {
  528. // Display the menu.
  529. if ( ! pmenu->TrackPopupMenu(
  530. TPM_LEFTALIGN | TPM_RIGHTBUTTON,
  531. point.x,
  532. point.y,
  533. this
  534. ) )
  535. {
  536. } // if: unsuccessfully displayed the menu
  537. } // if: there is a menu to display
  538. else
  539. {
  540. CBasePropertyPage::OnContextMenu( pWnd, point );
  541. } // else: no menu to display
  542. delete pmenu;
  543. } //*** CResourceGeneralPage::OnContextMenu()
  544. /////////////////////////////////////////////////////////////////////////////
  545. //++
  546. //
  547. // CResourceGeneralPage::OnModifyPossibleOwners
  548. //
  549. // Routine Description:
  550. // Handler for the BN_CLICKED message on the Modify Possible Owners button.
  551. //
  552. // Arguments:
  553. // None.
  554. //
  555. // Return Value:
  556. // None.
  557. //
  558. //--
  559. /////////////////////////////////////////////////////////////////////////////
  560. void CResourceGeneralPage::OnModifyPossibleOwners(void)
  561. {
  562. CModifyNodesDlg dlg(
  563. IDD_MODIFY_POSSIBLE_OWNERS,
  564. g_aHelpIDs_IDD_MODIFY_POSSIBLE_OWNERS,
  565. m_lpciPossibleOwners,
  566. PciRes()->PciResourceType()->LpcinodePossibleOwners(),
  567. LCPS_SHOW_IMAGES | LCPS_ALLOW_EMPTY
  568. );
  569. if (dlg.DoModal() == IDOK)
  570. {
  571. SetModified(TRUE);
  572. FillPossibleOwners();
  573. } // if: OK button pressed
  574. } //*** CResourceGeneralPage::OnModifyPossibleOwners()
  575. /////////////////////////////////////////////////////////////////////////////
  576. //++
  577. //
  578. // CResourceGeneralPage::OnDblClkPossibleOwners
  579. //
  580. // Routine Description:
  581. // Handler for the LBN_DBLCLK message on the Possible Owners listbox.
  582. //
  583. // Arguments:
  584. // None.
  585. //
  586. // Return Value:
  587. // None.
  588. //
  589. //--
  590. /////////////////////////////////////////////////////////////////////////////
  591. void CResourceGeneralPage::OnDblClkPossibleOwners(void)
  592. {
  593. OnProperties();
  594. } //*** CResourceGeneralPage::OnDblClkPossibleOwners()
  595. //*************************************************************************//
  596. /////////////////////////////////////////////////////////////////////////////
  597. // CResourceDependsPage property page
  598. /////////////////////////////////////////////////////////////////////////////
  599. IMPLEMENT_DYNCREATE(CResourceDependsPage, CBasePropertyPage)
  600. /////////////////////////////////////////////////////////////////////////////
  601. // Message Maps
  602. BEGIN_MESSAGE_MAP(CResourceDependsPage, CBasePropertyPage)
  603. //{{AFX_MSG_MAP(CResourceDependsPage)
  604. ON_BN_CLICKED(IDC_PP_RES_MODIFY, OnModify)
  605. ON_NOTIFY(NM_DBLCLK, IDC_PP_RES_DEPENDS_LIST, OnDblClkDependsList)
  606. ON_NOTIFY(LVN_COLUMNCLICK, IDC_PP_RES_DEPENDS_LIST, OnColumnClick)
  607. ON_BN_CLICKED(IDC_PP_RES_PROPERTIES, OnProperties)
  608. ON_WM_CONTEXTMENU()
  609. ON_NOTIFY(LVN_ITEMCHANGED, IDC_PP_RES_DEPENDS_LIST, OnItemChangedDependsList)
  610. //}}AFX_MSG_MAP
  611. ON_COMMAND(ID_FILE_PROPERTIES, OnProperties)
  612. END_MESSAGE_MAP()
  613. /////////////////////////////////////////////////////////////////////////////
  614. //++
  615. //
  616. // CResourceDependsPage::CResourceDependsPage
  617. //
  618. // Routine Description:
  619. // Constructor.
  620. //
  621. // Arguments:
  622. // None.
  623. //
  624. // Return Value:
  625. // None.
  626. //
  627. //--
  628. /////////////////////////////////////////////////////////////////////////////
  629. CResourceDependsPage::CResourceDependsPage(void)
  630. : CBasePropertyPage(IDD, g_aHelpIDs_IDD_PP_RES_DEPENDS)
  631. {
  632. //{{AFX_DATA_INIT(CResourceDependsPage)
  633. //}}AFX_DATA_INIT
  634. m_bQuorumResource = FALSE;
  635. } //*** CResourceDependsPage::CResourceDependsPage()
  636. /////////////////////////////////////////////////////////////////////////////
  637. //++
  638. //
  639. // CResourceDependsPage::BInit
  640. //
  641. // Routine Description:
  642. // Initialize the page.
  643. //
  644. // Arguments:
  645. // psht [IN OUT] Property sheet to which this page belongs.
  646. //
  647. // Return Value:
  648. // TRUE Page initialized successfully.
  649. // FALSE Page failed to initialize.
  650. //
  651. //--
  652. /////////////////////////////////////////////////////////////////////////////
  653. BOOL CResourceDependsPage::BInit(IN OUT CBaseSheet * psht)
  654. {
  655. BOOL bSuccess;
  656. ASSERT_KINDOF(CResourcePropSheet, psht);
  657. // Call the base class to do base-level initialization.
  658. // NOTE: MUST BE DONE BEFORE ACCESSING THE SHEET.
  659. bSuccess = CBasePropertyPage::BInit(psht);
  660. if (bSuccess)
  661. {
  662. try
  663. {
  664. // Duplicate the dependencies list.
  665. {
  666. POSITION pos;
  667. CResource * pciRes;
  668. pos = PciRes()->LpciresDependencies().GetHeadPosition();
  669. while (pos != NULL)
  670. {
  671. pciRes = (CResource *) PciRes()->LpciresDependencies().GetNext(pos);
  672. ASSERT_VALID(pciRes);
  673. m_lpciresDependencies.AddTail(pciRes);
  674. } // while: more nodes in the list
  675. } // Duplicate the dependencies list
  676. // Create the list of resources on which this resource can be dependent.
  677. {
  678. POSITION posPci;
  679. CResource * pciRes;
  680. CResourceList & rlpciResources = PciRes()->Pdoc()->LpciResources();
  681. LpciresAvailable().RemoveAll();
  682. posPci = rlpciResources.GetHeadPosition();
  683. while (posPci != NULL)
  684. {
  685. // Get the cluster item pointer.
  686. pciRes = (CResource *) rlpciResources.GetNext(posPci);
  687. ASSERT_VALID(pciRes);
  688. // If we CAN be dependent on this resource, add it to our Available list.
  689. if (PciRes()->BCanBeDependent(pciRes)
  690. || PciRes()->BIsDependent(pciRes))
  691. LpciresAvailable().AddTail(pciRes);
  692. } // while: more items in the list
  693. } // Create the list of resources on which this resource can be dependent
  694. // Determine if we are the quorum resource.
  695. m_bQuorumResource = (PciRes()->StrName() == PciRes()->Pdoc()->PciCluster()->StrQuorumResource());
  696. } // try
  697. catch (CException * pe)
  698. {
  699. pe->ReportError();
  700. pe->Delete();
  701. bSuccess = FALSE;
  702. } // catch: CException
  703. } // if: base class method was successful
  704. return bSuccess;
  705. } //*** CResourceDependsPage::BInit()
  706. /////////////////////////////////////////////////////////////////////////////
  707. //++
  708. //
  709. // CResourceDependsPage::DoDataExchange
  710. //
  711. // Routine Description:
  712. // Do data exchange between the dialog and the class.
  713. //
  714. // Arguments:
  715. // pDX [IN OUT] Data exchange object
  716. //
  717. // Return Value:
  718. // None.
  719. //
  720. //--
  721. /////////////////////////////////////////////////////////////////////////////
  722. void CResourceDependsPage::DoDataExchange(CDataExchange * pDX)
  723. {
  724. CBasePropertyPage::DoDataExchange(pDX);
  725. //{{AFX_DATA_MAP(CResourceDependsPage)
  726. DDX_Control(pDX, IDC_PP_RES_PROPERTIES, m_pbProperties);
  727. DDX_Control(pDX, IDC_PP_RES_MODIFY, m_pbModify);
  728. DDX_Control(pDX, IDC_PP_RES_DEPENDS_LIST, m_lcDependencies);
  729. //}}AFX_DATA_MAP
  730. if (pDX->m_bSaveAndValidate)
  731. {
  732. } // if: saving data from the dialog
  733. else
  734. {
  735. FillDependencies();
  736. } // else: setting data to the dialog
  737. } //*** CResourceDependsPage::DoDataExchange()
  738. /////////////////////////////////////////////////////////////////////////////
  739. //++
  740. //
  741. // CResourceDependsPage::FillDependencies
  742. //
  743. // Routine Description:
  744. // Fill the Possible Owners list box.
  745. //
  746. // Arguments:
  747. // None.
  748. //
  749. // Return Value:
  750. // None.
  751. //
  752. //--
  753. /////////////////////////////////////////////////////////////////////////////
  754. void CResourceDependsPage::FillDependencies(void)
  755. {
  756. POSITION pos;
  757. int iitem;
  758. int nitem;
  759. CResource * pciRes;
  760. m_lcDependencies.DeleteAllItems();
  761. pos = LpciresDependencies().GetHeadPosition();
  762. for (iitem = 0 ; pos != NULL ; iitem++)
  763. {
  764. pciRes = (CResource *) LpciresDependencies().GetNext(pos);
  765. ASSERT_VALID(pciRes);
  766. nitem = m_lcDependencies.InsertItem(iitem, pciRes->StrName(), pciRes->IimgObjectType());
  767. m_lcDependencies.SetItemText(nitem, 1, pciRes->StrRealResourceTypeDisplayName());
  768. m_lcDependencies.SetItemData(nitem, (DWORD_PTR) pciRes);
  769. } // for: each string in the list
  770. // Sort the items.
  771. m_nSortColumn = 0;
  772. m_nSortDirection = 0;
  773. m_lcDependencies.SortItems(CompareItems, (LPARAM) this);
  774. // If there are any items, set the focus on the first one.
  775. if (m_lcDependencies.GetItemCount() != 0)
  776. m_lcDependencies.SetItemState(0, LVIS_FOCUSED, LVIS_FOCUSED);
  777. } //*** CResourceDependsPage::FillDependencies()
  778. /////////////////////////////////////////////////////////////////////////////
  779. //++
  780. //
  781. // CResourceDependsPage::OnInitDialog
  782. //
  783. // Routine Description:
  784. // Handler for the WM_INITDIALOG message.
  785. //
  786. // Arguments:
  787. // None.
  788. //
  789. // Return Value:
  790. // TRUE Focus needs to be set.
  791. // FALSE Focus already set.
  792. //
  793. //--
  794. /////////////////////////////////////////////////////////////////////////////
  795. BOOL CResourceDependsPage::OnInitDialog(void)
  796. {
  797. // Call the base class method.
  798. CBasePropertyPage::OnInitDialog();
  799. // Enable the Properties button by default.
  800. m_pbProperties.EnableWindow(FALSE);
  801. // Change list view control extended styles.
  802. {
  803. DWORD dwExtendedStyle;
  804. dwExtendedStyle = (DWORD)m_lcDependencies.SendMessage(LVM_GETEXTENDEDLISTVIEWSTYLE);
  805. m_lcDependencies.SendMessage(
  806. LVM_SETEXTENDEDLISTVIEWSTYLE,
  807. 0,
  808. dwExtendedStyle
  809. | LVS_EX_FULLROWSELECT
  810. | LVS_EX_HEADERDRAGDROP
  811. );
  812. } // Change list view control extended styles
  813. // Set the image list for the list control to use.
  814. m_lcDependencies.SetImageList(GetClusterAdminApp()->PilSmallImages(), LVSIL_SMALL);
  815. // Add the columns.
  816. {
  817. CString strColumn;
  818. try
  819. {
  820. strColumn.LoadString(IDS_COLTEXT_NAME);
  821. m_lcDependencies.InsertColumn(0, strColumn, LVCFMT_LEFT, COLI_WIDTH_NAME * 3 / 2);
  822. strColumn.LoadString(IDS_COLTEXT_RESTYPE);
  823. m_lcDependencies.InsertColumn(1, strColumn, LVCFMT_LEFT, COLI_WIDTH_RESTYPE * 3 / 2);
  824. } // try
  825. catch (CException * pe)
  826. {
  827. pe->Delete();
  828. } // catch: CException
  829. } // Add the columns
  830. // Fill the list control.
  831. FillDependencies();
  832. if (BReadOnly())
  833. {
  834. m_pbModify.EnableWindow(FALSE);
  835. } // if: read-only page
  836. return TRUE; // return TRUE unless you set the focus to a control
  837. // EXCEPTION: OCX Property Pages should return FALSE
  838. } //*** CResourceDependsPage::OnInitDialog()
  839. /////////////////////////////////////////////////////////////////////////////
  840. //++
  841. //
  842. // CResourceDependsPage::OnApply
  843. //
  844. // Routine Description:
  845. // Handler for the PSM_APPLY message, which is sent when the Apply
  846. // button is pressed.
  847. //
  848. // Arguments:
  849. // None.
  850. //
  851. // Return Value:
  852. // TRUE Page successfully applied.
  853. // FALSE Error applying page.
  854. //
  855. //--
  856. /////////////////////////////////////////////////////////////////////////////
  857. BOOL CResourceDependsPage::OnApply(void)
  858. {
  859. ASSERT(!BReadOnly());
  860. // Check to see if required dependencies have been made.
  861. {
  862. CString strMissing;
  863. CString strMsg;
  864. try
  865. {
  866. if (!PciRes()->BRequiredDependenciesPresent(LpciresDependencies(), strMissing))
  867. {
  868. strMsg.FormatMessage(IDS_REQUIRED_DEPENDENCY_NOT_FOUND, strMissing);
  869. AfxMessageBox(strMsg, MB_OK | MB_ICONSTOP);
  870. return FALSE;
  871. } // if: all required dependencies not present
  872. } // try
  873. catch (CException * pe)
  874. {
  875. pe->ReportError();
  876. pe->Delete();
  877. return FALSE;
  878. } // catch: CException
  879. } // Check to see if required dependencies have been made
  880. // Set the data from the page in the cluster item.
  881. try
  882. {
  883. CWaitCursor wc;
  884. PciRes()->SetDependencies(LpciresDependencies());
  885. } // try
  886. catch (CException * pe)
  887. {
  888. pe->ReportError();
  889. pe->Delete();
  890. return FALSE;
  891. } // catch: CException
  892. return CBasePropertyPage::OnApply();
  893. } //*** CResourceDependsPage::OnApply()
  894. /////////////////////////////////////////////////////////////////////////////
  895. //++
  896. //
  897. // CResourceDependsPage::OnModify
  898. //
  899. // Routine Description:
  900. // Handler for the BN_CLICKED message on the Modify button.
  901. //
  902. // Arguments:
  903. // None.
  904. //
  905. // Return Value:
  906. // None.
  907. //
  908. //--
  909. /////////////////////////////////////////////////////////////////////////////
  910. void CResourceDependsPage::OnModify(void)
  911. {
  912. CModifyResourcesDlg dlg(
  913. IDD_MODIFY_DEPENDENCIES,
  914. g_aHelpIDs_IDD_MODIFY_DEPENDENCIES,
  915. m_lpciresDependencies,
  916. m_lpciresAvailable,
  917. LCPS_SHOW_IMAGES | LCPS_ALLOW_EMPTY
  918. );
  919. ASSERT(!BReadOnly());
  920. // If this is the quorum resource, display an error message.
  921. if (BQuorumResource())
  922. {
  923. AfxMessageBox(IDS_QUORUM_RES_CANT_HAVE_DEPS);
  924. } // if: this is the quorum resource
  925. else
  926. {
  927. if (dlg.DoModal() == IDOK)
  928. {
  929. SetModified(TRUE);
  930. FillDependencies();
  931. } // if: OK button pressed
  932. } // else: not the quorum resource
  933. } //*** CResourceDependsPage::OnModify()
  934. /////////////////////////////////////////////////////////////////////////////
  935. //++
  936. //
  937. // CResourceDependsPage::OnProperties
  938. //
  939. // Routine Description:
  940. // Handler for the BN_CLICKED message on the Properties button.
  941. //
  942. // Arguments:
  943. // None.
  944. //
  945. // Return Value:
  946. // None.
  947. //
  948. //--
  949. /////////////////////////////////////////////////////////////////////////////
  950. void CResourceDependsPage::OnProperties(void)
  951. {
  952. DisplayProperties();
  953. } //*** CResourceDependsPage::OnProperties()
  954. /////////////////////////////////////////////////////////////////////////////
  955. //++
  956. //
  957. // CListCtrlPair::OnItemChangedDependsList
  958. //
  959. // Routine Description:
  960. // Handler method for the LVN_ITEMCHANGED message in the dependencies
  961. // list.
  962. //
  963. // Arguments:
  964. // pNMHDR [IN OUT] WM_NOTIFY structure.
  965. // pResult [OUT] LRESULT in which to return the result of this operation.
  966. //
  967. // Return Value:
  968. // None.
  969. //
  970. //--
  971. /////////////////////////////////////////////////////////////////////////////
  972. void CResourceDependsPage::OnItemChangedDependsList(NMHDR * pNMHDR, LRESULT * pResult)
  973. {
  974. NM_LISTVIEW * pNMListView = (NM_LISTVIEW *) pNMHDR;
  975. // If the selection changed, enable/disable the Properties button.
  976. if ((pNMListView->uChanged & LVIF_STATE)
  977. && ((pNMListView->uOldState & LVIS_SELECTED)
  978. || (pNMListView->uNewState & LVIS_SELECTED))
  979. && !BReadOnly())
  980. {
  981. UINT cSelected = m_lcDependencies.GetSelectedCount();
  982. // If there is only one item selected, enable the Properties button.
  983. // Otherwise disable it.
  984. m_pbProperties.EnableWindow((cSelected == 1) ? TRUE : FALSE);
  985. } // if: selection changed
  986. *pResult = 0;
  987. } //*** CResourceDependsPage::OnItemChangedDependsList()
  988. /////////////////////////////////////////////////////////////////////////////
  989. //++
  990. //
  991. // CResourceDependsPage::OnContextMenu
  992. //
  993. // Routine Description:
  994. // Handler for the WM_CONTEXTMENU method.
  995. //
  996. // Arguments:
  997. // pWnd Window in which the user right clicked the mouse.
  998. // point Position of the cursor, in screen coordinates.
  999. //
  1000. // Return Value:
  1001. // None.
  1002. //
  1003. //--
  1004. /////////////////////////////////////////////////////////////////////////////
  1005. void CResourceDependsPage::OnContextMenu(CWnd * pWnd, CPoint point)
  1006. {
  1007. BOOL bHandled = FALSE;
  1008. CMenu * pmenu = NULL;
  1009. CListCtrl * pListCtrl = (CListCtrl *) pWnd;
  1010. CString strMenuName;
  1011. CWaitCursor wc;
  1012. // If focus is not in the list control, don't handle the message.
  1013. if (pWnd == &m_lcDependencies)
  1014. {
  1015. // Create the menu to display.
  1016. try
  1017. {
  1018. pmenu = new CMenu;
  1019. if ( pmenu == NULL )
  1020. {
  1021. AfxThrowMemoryException();
  1022. } // if: error allocating the menu
  1023. if ( pmenu->CreatePopupMenu() )
  1024. {
  1025. UINT nFlags = MF_STRING;
  1026. // If there are no items in the list, disable the menu item.
  1027. if ( pListCtrl->GetItemCount() == 0 )
  1028. {
  1029. nFlags |= MF_GRAYED;
  1030. } // if: no items in the list
  1031. // Add the Properties item to the menu.
  1032. strMenuName.LoadString( IDS_MENU_PROPERTIES );
  1033. if ( pmenu->AppendMenu( nFlags, ID_FILE_PROPERTIES, strMenuName ) )
  1034. {
  1035. bHandled = TRUE;
  1036. if ( ( pListCtrl->GetItemCount() != 0 )
  1037. && ( pListCtrl->GetNextItem( -1, LVNI_FOCUSED ) == -1 ) )
  1038. {
  1039. pListCtrl->SetItemState( 0, LVNI_FOCUSED, LVNI_FOCUSED );
  1040. } // if: no item selected
  1041. } // if: successfully added menu item
  1042. } // if: menu created successfully
  1043. } // try
  1044. catch ( CException * pe )
  1045. {
  1046. pe->ReportError();
  1047. pe->Delete();
  1048. } // catch: CException
  1049. } // if: focus is on the list control
  1050. if ( bHandled )
  1051. {
  1052. // Display the menu.
  1053. if ( ! pmenu->TrackPopupMenu(
  1054. TPM_LEFTALIGN | TPM_RIGHTBUTTON,
  1055. point.x,
  1056. point.y,
  1057. this
  1058. ) )
  1059. {
  1060. } // if: unsuccessfully displayed the menu
  1061. } // if: there is a menu to display
  1062. else
  1063. {
  1064. CBasePropertyPage::OnContextMenu( pWnd, point );
  1065. } // else: no menu to display
  1066. delete pmenu;
  1067. } //*** CResourceDependsPage::OnContextMenu()
  1068. /////////////////////////////////////////////////////////////////////////////
  1069. //++
  1070. //
  1071. // CResourceDependsPage::OnDblClkDependsList
  1072. //
  1073. // Routine Description:
  1074. // Handler method for the NM_DBLCLK message.
  1075. //
  1076. // Arguments:
  1077. // None.
  1078. //
  1079. // Return Value:
  1080. // None.
  1081. //
  1082. //--
  1083. /////////////////////////////////////////////////////////////////////////////
  1084. void CResourceDependsPage::OnDblClkDependsList(NMHDR * pNMHDR, LRESULT * pResult)
  1085. {
  1086. DisplayProperties();
  1087. *pResult = 0;
  1088. } //*** CResourceDependsPage::OnDblClkDependsList()
  1089. /////////////////////////////////////////////////////////////////////////////
  1090. //++
  1091. //
  1092. // CResourceDependsPage::OnColumnClick
  1093. //
  1094. // Routine Description:
  1095. // Handler method for the LVN_COLUMNCLICK message.
  1096. //
  1097. // Arguments:
  1098. // None.
  1099. //
  1100. // Return Value:
  1101. // None.
  1102. //
  1103. //--
  1104. /////////////////////////////////////////////////////////////////////////////
  1105. void CResourceDependsPage::OnColumnClick(NMHDR * pNMHDR, LRESULT * pResult)
  1106. {
  1107. NM_LISTVIEW * pNMListView = (NM_LISTVIEW *) pNMHDR;
  1108. if (m_lcDependencies.GetItemCount() != 0)
  1109. {
  1110. // Save the current sort column and direction.
  1111. if (pNMListView->iSubItem == m_nSortColumn)
  1112. m_nSortDirection ^= -1;
  1113. else
  1114. {
  1115. m_nSortColumn = pNMListView->iSubItem;
  1116. m_nSortDirection = 0;
  1117. } // else: different column
  1118. // Sort the list.
  1119. m_lcDependencies.SortItems(CompareItems, (LPARAM) this);
  1120. } // if: there are items in the list
  1121. *pResult = 0;
  1122. } //*** CResourceDependsPage::OnColumnClick()
  1123. /////////////////////////////////////////////////////////////////////////////
  1124. //++
  1125. //
  1126. // CResourceDependsPage::CompareItems [static]
  1127. //
  1128. // Routine Description:
  1129. // Callback function for the CListCtrl::SortItems method.
  1130. //
  1131. // Arguments:
  1132. // lparam1 First item to compare.
  1133. // lparam2 Second item to compare.
  1134. // lparamSort Sort parameter.
  1135. //
  1136. // Return Value:
  1137. // -1 First parameter comes before second.
  1138. // 0 First and second parameters are the same.
  1139. // 1 First parameter comes after second.
  1140. //
  1141. //--
  1142. /////////////////////////////////////////////////////////////////////////////
  1143. int CALLBACK CResourceDependsPage::CompareItems(
  1144. LPARAM lparam1,
  1145. LPARAM lparam2,
  1146. LPARAM lparamSort
  1147. )
  1148. {
  1149. CResource * pciRes1 = (CResource *) lparam1;
  1150. CResource * pciRes2 = (CResource *) lparam2;
  1151. CResourceDependsPage * ppage = (CResourceDependsPage *) lparamSort;
  1152. const CString * pstr1;
  1153. const CString * pstr2;
  1154. int nResult;
  1155. ASSERT_VALID(pciRes1);
  1156. ASSERT_VALID(pciRes2);
  1157. ASSERT_VALID(ppage);
  1158. // Get the strings from the list items.
  1159. if (ppage->m_nSortColumn == 1)
  1160. {
  1161. pstr1 = &pciRes1->StrRealResourceTypeDisplayName();
  1162. pstr2 = &pciRes2->StrRealResourceTypeDisplayName();
  1163. } // if: sorting on name column
  1164. else
  1165. {
  1166. pstr1 = &pciRes1->StrName();
  1167. pstr2 = &pciRes2->StrName();
  1168. } // else: sorting on resource type column
  1169. // Compare the two strings.
  1170. // Use CompareString() so that it will sort properly on localized builds.
  1171. nResult = CompareString(
  1172. LOCALE_USER_DEFAULT,
  1173. 0,
  1174. *pstr1,
  1175. pstr1->GetLength(),
  1176. *pstr2,
  1177. pstr2->GetLength()
  1178. );
  1179. if ( nResult == CSTR_LESS_THAN )
  1180. {
  1181. nResult = -1;
  1182. }
  1183. else if ( nResult == CSTR_EQUAL )
  1184. {
  1185. nResult = 0;
  1186. }
  1187. else if ( nResult == CSTR_GREATER_THAN )
  1188. {
  1189. nResult = 1;
  1190. }
  1191. else
  1192. {
  1193. // An error occurred. Ignore it.
  1194. nResult = 0;
  1195. }
  1196. // Return the result based on the direction we are sorting.
  1197. if (ppage->m_nSortDirection != 0)
  1198. nResult = -nResult;
  1199. return nResult;
  1200. } //*** CResourceDependsPage::CompareItems()
  1201. /////////////////////////////////////////////////////////////////////////////
  1202. //++
  1203. //
  1204. // CResourceDependsPage::DisplayProperties
  1205. //
  1206. // Routine Description:
  1207. // Display properties of the item with the focus.
  1208. //
  1209. // Arguments:
  1210. // None.
  1211. //
  1212. // Return Value:
  1213. // None.
  1214. //
  1215. //--
  1216. /////////////////////////////////////////////////////////////////////////////
  1217. void CResourceDependsPage::DisplayProperties()
  1218. {
  1219. int iitem;
  1220. CResource * pciRes;
  1221. // Get the item with the focus.
  1222. iitem = m_lcDependencies.GetNextItem(-1, LVNI_FOCUSED);
  1223. ASSERT(iitem != -1);
  1224. if (iitem != -1)
  1225. {
  1226. // Get the resource pointer.
  1227. pciRes = (CResource *) m_lcDependencies.GetItemData(iitem);
  1228. ASSERT_VALID(pciRes);
  1229. // Set properties of that item.
  1230. if (pciRes->BDisplayProperties())
  1231. {
  1232. m_lcDependencies.SetItem(
  1233. iitem,
  1234. 0,
  1235. LVIF_TEXT | LVIF_IMAGE,
  1236. pciRes->StrName(),
  1237. pciRes->IimgObjectType(),
  1238. 0,
  1239. 0,
  1240. 0
  1241. );
  1242. m_lcDependencies.SetItemData(iitem, (DWORD_PTR) pciRes);
  1243. m_lcDependencies.SetItemText(iitem, 1, pciRes->StrRealResourceTypeDisplayName());
  1244. } // if: properties changed
  1245. } // if: found an item with focus
  1246. } //*** CResourceDependsPage::DisplayProperties()
  1247. /////////////////////////////////////////////////////////////////////////////
  1248. //++
  1249. //
  1250. // CResourceDependsPage::BGetNetworkName [static]
  1251. //
  1252. // Routine Description:
  1253. // Get the name of a network name resource on which this resource is
  1254. // dependent.
  1255. //
  1256. // Arguments:
  1257. // lpszNetName [OUT] String in which to return the network name resource name.
  1258. // pcchNetName [IN OUT] Points to a variable that specifies the
  1259. // maximum size, in characters, of the buffer. This
  1260. // value shold be large enough to contain
  1261. // MAX_COMPUTERNAME_LENGTH + 1 characters. Upon
  1262. // return it contains the actual number of characters
  1263. // copied.
  1264. // pvContext [IN OUT] Context for the operation.
  1265. //
  1266. // Return Value:
  1267. // TRUE Resource is dependent on a network name resource.
  1268. // FALSE Resource is NOT dependent on a network name resource.
  1269. //
  1270. //--
  1271. /////////////////////////////////////////////////////////////////////////////
  1272. BOOL CALLBACK CResourceDependsPage::BGetNetworkName(
  1273. OUT WCHAR * lpszNetName,
  1274. IN OUT DWORD * pcchNetName,
  1275. IN OUT PVOID pvContext
  1276. )
  1277. {
  1278. POSITION pos;
  1279. CResource * pciRes;
  1280. CResourceDependsPage * ppage = (CResourceDependsPage *) pvContext;
  1281. ASSERT(lpszNetName != NULL);
  1282. ASSERT(pcchNetName != NULL);
  1283. ASSERT(*pcchNetName > MAX_COMPUTERNAME_LENGTH);
  1284. ASSERT_KINDOF(CResourceDependsPage, ppage);
  1285. pos = ppage->LpciresDependencies().GetHeadPosition();
  1286. while (pos != NULL)
  1287. {
  1288. pciRes = (CResource *) ppage->LpciresDependencies().GetNext(pos);
  1289. ASSERT_VALID(pciRes);
  1290. if (pciRes->StrRealResourceType().CompareNoCase(RESNAME_NETWORK_NAME) == 0)
  1291. {
  1292. DWORD dwStatus;
  1293. CString strNetName;
  1294. // Read the network name.
  1295. dwStatus = pciRes->DwReadValue(REGPARAM_NAME, REGPARAM_PARAMETERS, strNetName);
  1296. if (dwStatus != ERROR_SUCCESS)
  1297. return FALSE;
  1298. ASSERT(strNetName.GetLength() < (int) *pcchNetName);
  1299. wcscpy(lpszNetName, strNetName);
  1300. return TRUE;
  1301. } // if: found a match
  1302. else if (pciRes->BGetNetworkName(lpszNetName, pcchNetName))
  1303. return TRUE;
  1304. } // while: more items in the list
  1305. ASSERT_VALID(ppage->PciRes());
  1306. // If the resource has a direct dependency on a Network Name resource,
  1307. // we need to return FALSE because the user has removed it from the
  1308. // list here.
  1309. pos = ppage->PciRes()->LpciresDependencies().GetHeadPosition();
  1310. while (pos != NULL)
  1311. {
  1312. pciRes = (CResource *) ppage->PciRes()->LpciresDependencies().GetNext(pos);
  1313. ASSERT_VALID(pciRes);
  1314. if (pciRes->StrRealResourceType().CompareNoCase(RESNAME_NETWORK_NAME) == 0)
  1315. return FALSE;
  1316. } // while: more items in the list
  1317. // There is no direct dependency on a Network Name resource. Call
  1318. // the API to see if there is an indirect dependency.
  1319. return ppage->PciRes()->BGetNetworkName(lpszNetName, pcchNetName);
  1320. } //*** CResourceDependsPage::BGetNetworkName()
  1321. //*************************************************************************//
  1322. /////////////////////////////////////////////////////////////////////////////
  1323. // CResourceAdvancedPage property page
  1324. /////////////////////////////////////////////////////////////////////////////
  1325. IMPLEMENT_DYNCREATE(CResourceAdvancedPage, CBasePropertyPage)
  1326. /////////////////////////////////////////////////////////////////////////////
  1327. // Message Maps
  1328. BEGIN_MESSAGE_MAP(CResourceAdvancedPage, CBasePropertyPage)
  1329. //{{AFX_MSG_MAP(CResourceAdvancedPage)
  1330. ON_BN_CLICKED(IDC_PP_RES_DONT_RESTART, OnClickedDontRestart)
  1331. ON_BN_CLICKED(IDC_PP_RES_RESTART, OnClickedRestart)
  1332. ON_BN_CLICKED(IDC_PP_RES_DEFAULT_LOOKS_ALIVE, OnClickedDefaultLooksAlive)
  1333. ON_BN_CLICKED(IDC_PP_RES_DEFAULT_IS_ALIVE, OnClickedDefaultIsAlive)
  1334. ON_EN_CHANGE(IDC_PP_RES_LOOKS_ALIVE, OnChangeLooksAlive)
  1335. ON_EN_CHANGE(IDC_PP_RES_IS_ALIVE, OnChangeIsAlive)
  1336. ON_BN_CLICKED(IDC_PP_RES_SPECIFY_LOOKS_ALIVE, OnClickedSpecifyLooksAlive)
  1337. ON_BN_CLICKED(IDC_PP_RES_SPECIFY_IS_ALIVE, OnClickedSpecifyIsAlive)
  1338. //}}AFX_MSG_MAP
  1339. ON_BN_CLICKED(IDC_PP_RES_AFFECT_THE_GROUP, CBasePropertyPage::OnChangeCtrl)
  1340. ON_EN_CHANGE(IDC_PP_RES_RESTART_THRESHOLD, CBasePropertyPage::OnChangeCtrl)
  1341. ON_EN_CHANGE(IDC_PP_RES_RESTART_PERIOD, CBasePropertyPage::OnChangeCtrl)
  1342. ON_EN_CHANGE(IDC_PP_RES_PENDING_TIMEOUT, CBasePropertyPage::OnChangeCtrl)
  1343. ON_BN_CLICKED(IDC_PP_RES_SPECIFY_LOOKS_ALIVE, CBasePropertyPage::OnChangeCtrl)
  1344. ON_BN_CLICKED(IDC_PP_RES_SPECIFY_IS_ALIVE, CBasePropertyPage::OnChangeCtrl)
  1345. END_MESSAGE_MAP()
  1346. /////////////////////////////////////////////////////////////////////////////
  1347. //++
  1348. //
  1349. // CResourceAdvancedPage::CResourceAdvancedPage
  1350. //
  1351. // Routine Description:
  1352. // Constructor.
  1353. //
  1354. // Arguments:
  1355. // None.
  1356. //
  1357. // Return Value:
  1358. // None.
  1359. //
  1360. //--
  1361. /////////////////////////////////////////////////////////////////////////////
  1362. CResourceAdvancedPage::CResourceAdvancedPage(void)
  1363. : CBasePropertyPage(IDD, g_aHelpIDs_IDD_PP_RES_ADVANCED)
  1364. {
  1365. //{{AFX_DATA_INIT(CResourceAdvancedPage)
  1366. m_bAffectTheGroup = FALSE;
  1367. m_nRestart = -1;
  1368. //}}AFX_DATA_INIT
  1369. } //*** CResourceAdvancedPage::CResourceAdvancedPage()
  1370. /////////////////////////////////////////////////////////////////////////////
  1371. //++
  1372. //
  1373. // CResourceAdvancedPage::BInit
  1374. //
  1375. // Routine Description:
  1376. // Initialize the page.
  1377. //
  1378. // Arguments:
  1379. // psht [IN OUT] Property sheet to which this page belongs.
  1380. //
  1381. // Return Value:
  1382. // TRUE Page initialized successfully.
  1383. // FALSE Page failed to initialize.
  1384. //
  1385. //--
  1386. /////////////////////////////////////////////////////////////////////////////
  1387. BOOL CResourceAdvancedPage::BInit(IN OUT CBaseSheet * psht)
  1388. {
  1389. BOOL bSuccess;
  1390. ASSERT_KINDOF(CResourcePropSheet, psht);
  1391. bSuccess = CBasePropertyPage::BInit(psht);
  1392. if (bSuccess)
  1393. {
  1394. m_crraRestartAction = PciRes()->CrraRestartAction();
  1395. m_nRestart = 1;
  1396. m_bAffectTheGroup = FALSE;
  1397. if (m_crraRestartAction == ClusterResourceDontRestart)
  1398. m_nRestart = 0;
  1399. else if (m_crraRestartAction == ClusterResourceRestartNotify)
  1400. m_bAffectTheGroup = TRUE;
  1401. m_nThreshold = PciRes()->NRestartThreshold();
  1402. m_nPeriod = PciRes()->NRestartPeriod() / 1000; // display units are seconds, stored units are milliseconds
  1403. m_nLooksAlive = PciRes()->NLooksAlive();
  1404. m_nIsAlive = PciRes()->NIsAlive();
  1405. m_nPendingTimeout = PciRes()->NPendingTimeout() / 1000; // display units are seconds, stored units are milliseconds
  1406. } // if: base class method was successful
  1407. return TRUE;
  1408. } //*** CResourceAdvancedPage::BInit()
  1409. /////////////////////////////////////////////////////////////////////////////
  1410. //++
  1411. //
  1412. // CResourceAdvancedPage::DoDataExchange
  1413. //
  1414. // Routine Description:
  1415. // Do data exchange between the dialog and the class.
  1416. //
  1417. // Arguments:
  1418. // pDX [IN OUT] Data exchange object
  1419. //
  1420. // Return Value:
  1421. // None.
  1422. //
  1423. //--
  1424. /////////////////////////////////////////////////////////////////////////////
  1425. void CResourceAdvancedPage::DoDataExchange(CDataExchange * pDX)
  1426. {
  1427. CBasePropertyPage::DoDataExchange(pDX);
  1428. //{{AFX_DATA_MAP(CResourceAdvancedPage)
  1429. DDX_Control(pDX, IDC_PP_RES_AFFECT_THE_GROUP, m_ckbAffectTheGroup);
  1430. DDX_Control(pDX, IDC_PP_RES_PENDING_TIMEOUT, m_editPendingTimeout);
  1431. DDX_Control(pDX, IDC_PP_RES_DEFAULT_LOOKS_ALIVE, m_rbDefaultLooksAlive);
  1432. DDX_Control(pDX, IDC_PP_RES_SPECIFY_LOOKS_ALIVE, m_rbSpecifyLooksAlive);
  1433. DDX_Control(pDX, IDC_PP_RES_DEFAULT_IS_ALIVE, m_rbDefaultIsAlive);
  1434. DDX_Control(pDX, IDC_PP_RES_SPECIFY_IS_ALIVE, m_rbSpecifyIsAlive);
  1435. DDX_Control(pDX, IDC_PP_RES_LOOKS_ALIVE, m_editLooksAlive);
  1436. DDX_Control(pDX, IDC_PP_RES_IS_ALIVE, m_editIsAlive);
  1437. DDX_Control(pDX, IDC_PP_RES_DONT_RESTART, m_rbDontRestart);
  1438. DDX_Control(pDX, IDC_PP_RES_RESTART, m_rbRestart);
  1439. DDX_Control(pDX, IDC_PP_RES_RESTART_THRESHOLD, m_editThreshold);
  1440. DDX_Control(pDX, IDC_PP_RES_RESTART_PERIOD, m_editPeriod);
  1441. DDX_Check(pDX, IDC_PP_RES_AFFECT_THE_GROUP, m_bAffectTheGroup);
  1442. DDX_Radio(pDX, IDC_PP_RES_DONT_RESTART, m_nRestart);
  1443. //}}AFX_DATA_MAP
  1444. if (pDX->m_bSaveAndValidate)
  1445. {
  1446. CString strValue;
  1447. if (!BReadOnly())
  1448. {
  1449. if (m_nRestart == 1)
  1450. {
  1451. DDX_Number(
  1452. pDX,
  1453. IDC_PP_RES_RESTART_THRESHOLD,
  1454. m_nThreshold,
  1455. CLUSTER_RESOURCE_MINIMUM_RESTART_THRESHOLD,
  1456. CLUSTER_RESOURCE_MAXIMUM_RESTART_THRESHOLD
  1457. );
  1458. DDX_Number(
  1459. pDX,
  1460. IDC_PP_RES_RESTART_PERIOD,
  1461. m_nPeriod,
  1462. CLUSTER_RESOURCE_MINIMUM_RESTART_PERIOD,
  1463. CLUSTER_RESOURCE_MAXIMUM_RESTART_PERIOD / 1000 // display units are seconds, stored units are milliseconds
  1464. );
  1465. } // if: restart is enabled
  1466. if (m_rbDefaultLooksAlive.GetCheck() == BST_CHECKED)
  1467. m_nLooksAlive = CLUSTER_RESOURCE_USE_DEFAULT_POLL_INTERVAL;
  1468. else
  1469. DDX_Number(
  1470. pDX,
  1471. IDC_PP_RES_LOOKS_ALIVE,
  1472. m_nLooksAlive,
  1473. CLUSTER_RESOURCE_MINIMUM_LOOKS_ALIVE,
  1474. CLUSTER_RESOURCE_MAXIMUM_LOOKS_ALIVE_UI
  1475. );
  1476. if (m_rbDefaultIsAlive.GetCheck() == BST_CHECKED)
  1477. m_nIsAlive = CLUSTER_RESOURCE_USE_DEFAULT_POLL_INTERVAL;
  1478. else
  1479. DDX_Number(
  1480. pDX,
  1481. IDC_PP_RES_IS_ALIVE,
  1482. m_nIsAlive,
  1483. CLUSTER_RESOURCE_MINIMUM_IS_ALIVE,
  1484. CLUSTER_RESOURCE_MAXIMUM_IS_ALIVE_UI
  1485. );
  1486. DDX_Number(
  1487. pDX,
  1488. IDC_PP_RES_PENDING_TIMEOUT,
  1489. m_nPendingTimeout,
  1490. CLUSTER_RESOURCE_MINIMUM_PENDING_TIMEOUT,
  1491. CLUSTER_RESOURCE_MAXIMUM_PENDING_TIMEOUT / 1000 // display units are seconds, stored units are milliseconds
  1492. );
  1493. try
  1494. {
  1495. PciRes()->ValidateCommonProperties(
  1496. PciRes()->StrDescription(),
  1497. PciRes()->BSeparateMonitor(),
  1498. m_nLooksAlive,
  1499. m_nIsAlive,
  1500. m_crraRestartAction,
  1501. m_nThreshold,
  1502. m_nPeriod * 1000, // display units are seconds, stored units are milliseconds
  1503. m_nPendingTimeout * 1000 // display units are seconds, stored units are milliseconds
  1504. );
  1505. } // try
  1506. catch (CException * pe)
  1507. {
  1508. pe->ReportError();
  1509. pe->Delete();
  1510. pDX->Fail();
  1511. } // catch: CException
  1512. } // if: not read only
  1513. } // if: saving data
  1514. else
  1515. {
  1516. DDX_Number(
  1517. pDX,
  1518. IDC_PP_RES_RESTART_THRESHOLD,
  1519. m_nThreshold,
  1520. CLUSTER_RESOURCE_MINIMUM_RESTART_THRESHOLD,
  1521. CLUSTER_RESOURCE_MAXIMUM_RESTART_THRESHOLD
  1522. );
  1523. DDX_Number(
  1524. pDX,
  1525. IDC_PP_RES_RESTART_PERIOD,
  1526. m_nPeriod,
  1527. CLUSTER_RESOURCE_MINIMUM_RESTART_PERIOD,
  1528. CLUSTER_RESOURCE_MAXIMUM_RESTART_PERIOD / 1000 // display units are seconds, stored units are milliseconds
  1529. );
  1530. if (m_nRestart == 0)
  1531. {
  1532. m_rbDontRestart.SetCheck(BST_CHECKED);
  1533. m_rbRestart.SetCheck(BST_UNCHECKED);
  1534. OnClickedDontRestart();
  1535. } // if: Don't Restart selected
  1536. else
  1537. {
  1538. m_rbDontRestart.SetCheck(BST_UNCHECKED);
  1539. m_rbRestart.SetCheck(BST_CHECKED);
  1540. OnClickedRestart();
  1541. } // else: Restart selected
  1542. if (m_nLooksAlive == (DWORD) CLUSTER_RESOURCE_USE_DEFAULT_POLL_INTERVAL)
  1543. {
  1544. DWORD nLooksAlive;
  1545. if (PciRes()->PciResourceType() == NULL)
  1546. {
  1547. m_rbDefaultLooksAlive.EnableWindow(FALSE);
  1548. m_rbSpecifyLooksAlive.EnableWindow(FALSE);
  1549. m_editLooksAlive.EnableWindow(FALSE);
  1550. m_editLooksAlive.SetWindowText(_T(""));
  1551. } // if: no resource type
  1552. else
  1553. {
  1554. ASSERT_VALID(PciRes()->PciResourceType());
  1555. nLooksAlive = PciRes()->PciResourceType()->NLooksAlive();
  1556. DDX_Text(pDX, IDC_PP_RES_LOOKS_ALIVE, nLooksAlive);
  1557. m_editLooksAlive.SetReadOnly();
  1558. } // else: resource type known
  1559. m_rbDefaultLooksAlive.SetCheck(BST_CHECKED);
  1560. m_rbSpecifyLooksAlive.SetCheck(BST_UNCHECKED);
  1561. } // if: using default
  1562. else
  1563. {
  1564. m_rbDefaultLooksAlive.SetCheck(BST_UNCHECKED);
  1565. m_rbSpecifyLooksAlive.SetCheck(BST_CHECKED);
  1566. DDX_Number(
  1567. pDX,
  1568. IDC_PP_RES_LOOKS_ALIVE,
  1569. m_nLooksAlive,
  1570. CLUSTER_RESOURCE_MINIMUM_LOOKS_ALIVE,
  1571. CLUSTER_RESOURCE_MAXIMUM_LOOKS_ALIVE_UI
  1572. );
  1573. m_editLooksAlive.SetReadOnly(FALSE);
  1574. } // if: not using default
  1575. if (m_nIsAlive == (DWORD) CLUSTER_RESOURCE_USE_DEFAULT_POLL_INTERVAL)
  1576. {
  1577. DWORD nIsAlive;
  1578. if (PciRes()->PciResourceType() == NULL)
  1579. {
  1580. m_rbDefaultIsAlive.EnableWindow(FALSE);
  1581. m_rbSpecifyIsAlive.EnableWindow(FALSE);
  1582. m_editIsAlive.EnableWindow(FALSE);
  1583. m_editIsAlive.SetWindowText(_T(""));
  1584. } // if: no resource type
  1585. else
  1586. {
  1587. ASSERT_VALID(PciRes()->PciResourceType());
  1588. nIsAlive = PciRes()->PciResourceType()->NIsAlive();
  1589. DDX_Text(pDX, IDC_PP_RES_IS_ALIVE, nIsAlive);
  1590. m_editIsAlive.SetReadOnly();
  1591. } // else: resource type known
  1592. m_rbDefaultIsAlive.SetCheck(BST_CHECKED);
  1593. m_rbSpecifyIsAlive.SetCheck(BST_UNCHECKED);
  1594. } // if: using default
  1595. else
  1596. {
  1597. m_rbDefaultIsAlive.SetCheck(BST_UNCHECKED);
  1598. m_rbSpecifyIsAlive.SetCheck(BST_CHECKED);
  1599. DDX_Number(
  1600. pDX,
  1601. IDC_PP_RES_IS_ALIVE,
  1602. m_nIsAlive,
  1603. CLUSTER_RESOURCE_MINIMUM_IS_ALIVE,
  1604. CLUSTER_RESOURCE_MAXIMUM_IS_ALIVE_UI
  1605. );
  1606. m_editIsAlive.SetReadOnly(FALSE);
  1607. } // if: not using default
  1608. DDX_Number(
  1609. pDX,
  1610. IDC_PP_RES_PENDING_TIMEOUT,
  1611. m_nPendingTimeout,
  1612. CLUSTER_RESOURCE_MINIMUM_PENDING_TIMEOUT,
  1613. CLUSTER_RESOURCE_MAXIMUM_PENDING_TIMEOUT / 1000 // display units are seconds, stored units are milliseconds
  1614. );
  1615. } // else: not saving data
  1616. } //*** CResourceAdvancedPage::DoDataExchange()
  1617. /////////////////////////////////////////////////////////////////////////////
  1618. //++
  1619. //
  1620. // CResourceAdvancedPage::OnInitDialog
  1621. //
  1622. // Routine Description:
  1623. // Handler for the WM_INITDIALOG message.
  1624. //
  1625. // Arguments:
  1626. // None.
  1627. //
  1628. // Return Value:
  1629. // TRUE Focus needs to be set.
  1630. // FALSE Focus already set.
  1631. //
  1632. //--
  1633. /////////////////////////////////////////////////////////////////////////////
  1634. BOOL CResourceAdvancedPage::OnInitDialog(void)
  1635. {
  1636. CBasePropertyPage::OnInitDialog();
  1637. // If read-only, set all controls to be either disabled or read-only.
  1638. if (BReadOnly())
  1639. {
  1640. m_rbDontRestart.EnableWindow(FALSE);
  1641. m_rbRestart.EnableWindow(FALSE);
  1642. m_ckbAffectTheGroup.EnableWindow(FALSE);
  1643. m_editThreshold.SetReadOnly(TRUE);
  1644. m_editPeriod.SetReadOnly(TRUE);
  1645. m_rbDefaultLooksAlive.EnableWindow(FALSE);
  1646. m_rbSpecifyLooksAlive.EnableWindow(FALSE);
  1647. m_editLooksAlive.SetReadOnly(TRUE);
  1648. m_rbDefaultIsAlive.EnableWindow(FALSE);
  1649. m_rbSpecifyIsAlive.EnableWindow(FALSE);
  1650. m_editIsAlive.SetReadOnly(TRUE);
  1651. m_editPendingTimeout.SetReadOnly(TRUE);
  1652. } // if: sheet is read-only
  1653. return TRUE; // return TRUE unless you set the focus to a control
  1654. // EXCEPTION: OCX Property Pages should return FALSE
  1655. } //*** CResourceAdvancedPage::OnInitDialog()
  1656. /////////////////////////////////////////////////////////////////////////////
  1657. //++
  1658. //
  1659. // CResourceAdvancedPage::OnApply
  1660. //
  1661. // Routine Description:
  1662. // Handler for when the Apply button is pressed.
  1663. //
  1664. // Arguments:
  1665. // None.
  1666. //
  1667. // Return Value:
  1668. // TRUE Page successfully applied.
  1669. // FALSE Error applying page.
  1670. //
  1671. //--
  1672. /////////////////////////////////////////////////////////////////////////////
  1673. BOOL CResourceAdvancedPage::OnApply(void)
  1674. {
  1675. // Set the data from the page in the cluster item.
  1676. try
  1677. {
  1678. CWaitCursor wc;
  1679. if (m_nRestart == 0)
  1680. m_crraRestartAction = ClusterResourceDontRestart;
  1681. else if (m_bAffectTheGroup)
  1682. m_crraRestartAction = ClusterResourceRestartNotify;
  1683. else
  1684. m_crraRestartAction = ClusterResourceRestartNoNotify;
  1685. PciRes()->SetCommonProperties(
  1686. PciRes()->StrDescription(),
  1687. PciRes()->BSeparateMonitor(),
  1688. m_nLooksAlive,
  1689. m_nIsAlive,
  1690. m_crraRestartAction,
  1691. m_nThreshold,
  1692. m_nPeriod * 1000, // display units are seconds, stored units are milliseconds
  1693. m_nPendingTimeout * 1000 // display units are seconds, stored units are milliseconds
  1694. );
  1695. } // try
  1696. catch (CException * pe)
  1697. {
  1698. pe->ReportError();
  1699. pe->Delete();
  1700. return FALSE;
  1701. } // catch: CException
  1702. return CBasePropertyPage::OnApply();
  1703. } //*** CResourceAdvancedPage::OnApply()
  1704. /////////////////////////////////////////////////////////////////////////////
  1705. //++
  1706. //
  1707. // CResourceAdvancedPage::OnClickedDontRestart
  1708. //
  1709. // Routine Description:
  1710. // Handler for the BN_CLICKED message on the Don't Restart radio button.
  1711. //
  1712. // Arguments:
  1713. // None.
  1714. //
  1715. // Return Value:
  1716. // None.
  1717. //
  1718. //--
  1719. /////////////////////////////////////////////////////////////////////////////
  1720. void CResourceAdvancedPage::OnClickedDontRestart(void)
  1721. {
  1722. // Disable the restart parameter controls.
  1723. m_ckbAffectTheGroup.EnableWindow(FALSE);
  1724. m_editThreshold.EnableWindow(FALSE);
  1725. m_editPeriod.EnableWindow(FALSE);
  1726. // Call the base class method if the state changed.
  1727. if (m_nRestart != 0)
  1728. {
  1729. CBasePropertyPage::OnChangeCtrl();
  1730. } // if: state changed
  1731. } //*** CResourceAdvancedPage::OnClickedDontRestart()
  1732. /////////////////////////////////////////////////////////////////////////////
  1733. //++
  1734. //
  1735. // CResourceAdvancedPage::OnClickedRestart
  1736. //
  1737. // Routine Description:
  1738. // Handler for the BN_CLICKED message on the Restart No Notify radio button.
  1739. //
  1740. // Arguments:
  1741. // None.
  1742. //
  1743. // Return Value:
  1744. // None.
  1745. //
  1746. //--
  1747. /////////////////////////////////////////////////////////////////////////////
  1748. void CResourceAdvancedPage::OnClickedRestart(void)
  1749. {
  1750. // Enable the restart parameter controls.
  1751. m_ckbAffectTheGroup.EnableWindow(TRUE);
  1752. m_editThreshold.EnableWindow(TRUE);
  1753. m_editPeriod.EnableWindow(TRUE);
  1754. // Call the base class method if the state changed.
  1755. if (m_nRestart != 1)
  1756. {
  1757. m_ckbAffectTheGroup.SetCheck(BST_CHECKED);
  1758. CBasePropertyPage::OnChangeCtrl();
  1759. } // if: state changed
  1760. } //*** CResourceAdvancedPage::OnClickedRestart()
  1761. /////////////////////////////////////////////////////////////////////////////
  1762. //++
  1763. //
  1764. // CResourceAdvancedPage::OnChangeLooksAlive
  1765. //
  1766. // Routine Description:
  1767. // Handler for the EN_CHANGE message on the Looks Alive edit control.
  1768. //
  1769. // Arguments:
  1770. // None.
  1771. //
  1772. // Return Value:
  1773. // None.
  1774. //
  1775. //--
  1776. /////////////////////////////////////////////////////////////////////////////
  1777. void CResourceAdvancedPage::OnChangeLooksAlive(void)
  1778. {
  1779. m_rbDefaultLooksAlive.SetCheck(BST_UNCHECKED);
  1780. m_rbSpecifyLooksAlive.SetCheck(BST_CHECKED);
  1781. CBasePropertyPage::OnChangeCtrl();
  1782. } //*** CResourceAdvancedPage::OnChangeLooksAlive()
  1783. /////////////////////////////////////////////////////////////////////////////
  1784. //++
  1785. //
  1786. // CResourceAdvancedPage::OnChangeIsAlive
  1787. //
  1788. // Routine Description:
  1789. // Handler for the EN_CHANGE message on the Is Alive edit control.
  1790. //
  1791. // Arguments:
  1792. // None.
  1793. //
  1794. // Return Value:
  1795. // None.
  1796. //
  1797. //--
  1798. /////////////////////////////////////////////////////////////////////////////
  1799. void CResourceAdvancedPage::OnChangeIsAlive(void)
  1800. {
  1801. m_rbDefaultIsAlive.SetCheck(BST_UNCHECKED);
  1802. m_rbSpecifyIsAlive.SetCheck(BST_CHECKED);
  1803. CBasePropertyPage::OnChangeCtrl();
  1804. } //*** CResourceAdvancedPage::OnChangeIsAlive()
  1805. /////////////////////////////////////////////////////////////////////////////
  1806. //++
  1807. //
  1808. // CResourceAdvancedPage::OnClickedDefaultLooksAlive
  1809. //
  1810. // Routine Description:
  1811. // Handler for the BN_CLICKED message on the Use Default Looks Alive radio button.
  1812. //
  1813. // Arguments:
  1814. // None.
  1815. //
  1816. // Return Value:
  1817. // None.
  1818. //
  1819. //--
  1820. /////////////////////////////////////////////////////////////////////////////
  1821. void CResourceAdvancedPage::OnClickedDefaultLooksAlive(void)
  1822. {
  1823. if (m_nLooksAlive != (DWORD) CLUSTER_RESOURCE_USE_DEFAULT_POLL_INTERVAL)
  1824. {
  1825. CString str;
  1826. str.Format(_T("%u"), PciRes()->PciResourceType()->NLooksAlive());
  1827. m_editLooksAlive.SetWindowText(str);
  1828. m_rbDefaultLooksAlive.SetCheck(BST_CHECKED);
  1829. m_rbSpecifyLooksAlive.SetCheck(BST_UNCHECKED);
  1830. m_editLooksAlive.SetReadOnly();
  1831. CBasePropertyPage::OnChangeCtrl();
  1832. } // if: value changed
  1833. } //*** CResourceAdvancedPage::OnClickedDefaultLooksAlive()
  1834. /////////////////////////////////////////////////////////////////////////////
  1835. //++
  1836. //
  1837. // CResourceAdvancedPage::OnClickedDefaultIsAlive
  1838. //
  1839. // Routine Description:
  1840. // Handler for the BN_CLICKED message on the Use Default Is Alive radio button.
  1841. //
  1842. // Arguments:
  1843. // None.
  1844. //
  1845. // Return Value:
  1846. // None.
  1847. //
  1848. //--
  1849. /////////////////////////////////////////////////////////////////////////////
  1850. void CResourceAdvancedPage::OnClickedDefaultIsAlive(void)
  1851. {
  1852. if (m_nIsAlive != (DWORD) CLUSTER_RESOURCE_USE_DEFAULT_POLL_INTERVAL)
  1853. {
  1854. CString str;
  1855. str.Format(_T("%u"), PciRes()->PciResourceType()->NIsAlive());
  1856. m_editIsAlive.SetWindowText(str);
  1857. m_rbDefaultIsAlive.SetCheck(BST_CHECKED);
  1858. m_rbSpecifyIsAlive.SetCheck(BST_UNCHECKED);
  1859. m_editIsAlive.SetReadOnly();
  1860. CBasePropertyPage::OnChangeCtrl();
  1861. } // if: value changed
  1862. } //*** CResourceAdvancedPage::OnClickedDefaultIsAlive()
  1863. /////////////////////////////////////////////////////////////////////////////
  1864. //++
  1865. //
  1866. // CResourceAdvancedPage::OnClickedSpecifyLooksAlive
  1867. //
  1868. // Routine Description:
  1869. // Handler for the BN_CLICKED message on the Specify Looks Alive radio button.
  1870. //
  1871. // Arguments:
  1872. // None.
  1873. //
  1874. // Return Value:
  1875. // None.
  1876. //
  1877. //--
  1878. /////////////////////////////////////////////////////////////////////////////
  1879. void CResourceAdvancedPage::OnClickedSpecifyLooksAlive(void)
  1880. {
  1881. m_editLooksAlive.SetReadOnly(FALSE);
  1882. CBasePropertyPage::OnChangeCtrl();
  1883. } //*** CResourceAdvancedPage::OnClickedSpecifyLooksAlive()
  1884. /////////////////////////////////////////////////////////////////////////////
  1885. //++
  1886. //
  1887. // CResourceAdvancedPage::OnClickedSpecifyIsAlive
  1888. //
  1889. // Routine Description:
  1890. // Handler for the BN_CLICKED message on the Specify Is Alive radio button.
  1891. //
  1892. // Arguments:
  1893. // None.
  1894. //
  1895. // Return Value:
  1896. // None.
  1897. //
  1898. //--
  1899. /////////////////////////////////////////////////////////////////////////////
  1900. void CResourceAdvancedPage::OnClickedSpecifyIsAlive(void)
  1901. {
  1902. m_editIsAlive.SetReadOnly(FALSE);
  1903. CBasePropertyPage::OnChangeCtrl();
  1904. } //*** CResourceAdvancedPage::OnClickedSpecifyIsAlive()