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.

639 lines
18 KiB

  1. // DataElementScopeItem.cpp: implementation of the CDataElementScopeItem class.
  2. //
  3. //////////////////////////////////////////////////////////////////////
  4. //
  5. // 03/04/00 v-marfin bug 59643 : Set details page as the starting page.
  6. // 03/22/00 v-marfin bug 59675 : Rearranged data element context menu items
  7. // 04/02/00 v-marfin bug 59643b: Make General Page the first page, but set
  8. // details page as the focus on a new data collector.
  9. //
  10. //
  11. //
  12. #include "stdafx.h"
  13. #include "snapin.h"
  14. #include "DataElementScopeItem.h"
  15. #include "DataElementResultsView.h"
  16. #include "HealthmonScopePane.h"
  17. #include "DataElement.h"
  18. #include "DPGeneralPage.h"
  19. #include "DPPerfMonPage.h"
  20. #include "DPFileInfoPage.h"
  21. #include "DPGenericPage.h"
  22. #include "DPWmiQueryPage.h"
  23. #include "DPWmiPolledQueryPage.h"
  24. #include "DPHttpPage.h"
  25. #include "DPNtEventPage.h"
  26. #include "DPServicePage.h"
  27. #include "DPInetProtocolPage.h"
  28. #include "DPSchedulePage.h"
  29. #include "DPSNMPDataPage.h"
  30. #include "DPSmtpPage.h"
  31. #include "DPFtpPage.h"
  32. #include "DPIcmpPage.h"
  33. #include "DPComPlusPage.h"
  34. #include "ActionAssociationPage.h"
  35. #ifdef _DEBUG
  36. #undef THIS_FILE
  37. static char THIS_FILE[]=__FILE__;
  38. #define new DEBUG_NEW
  39. #endif
  40. // {6121CC48-C9E2-11d2-BD8D-0000F87A3912}
  41. static GUID GUID_DataElement =
  42. { 0x6121cc48, 0xc9e2, 0x11d2, { 0xbd, 0x8d, 0x0, 0x0, 0xf8, 0x7a, 0x39, 0x12 } };
  43. IMPLEMENT_DYNCREATE(CDataElementScopeItem,CHMScopeItem)
  44. // icon table - associates state to icons
  45. static UINT _Icons[HMS_MAX_STATES] =
  46. {
  47. IDI_ICON_DATAPOINT,
  48. IDI_ICON_DATAPOINT_DISABLED,
  49. IDI_ICON_DATAPOINT_OUTAGE,
  50. IDI_ICON_DATAPOINT_UNKNOWN,
  51. IDI_ICON_DATAPOINT_NO_CONNECT,
  52. IDI_ICON_DATAPOINT_WARNING,
  53. IDI_ICON_DATAPOINT_CRITICAL
  54. };
  55. //////////////////////////////////////////////////////////////////////
  56. // Construction/Destruction
  57. //////////////////////////////////////////////////////////////////////
  58. CDataElementScopeItem::CDataElementScopeItem()
  59. {
  60. m_lpguidItemType = &GUID_DataElement;
  61. }
  62. CDataElementScopeItem::~CDataElementScopeItem()
  63. {
  64. Destroy();
  65. }
  66. //////////////////////////////////////////////////////////////////////
  67. // Creation Members
  68. //////////////////////////////////////////////////////////////////////
  69. bool CDataElementScopeItem::Create(CScopePane* pScopePane, CScopePaneItem* pParentItem)
  70. {
  71. TRACEX(_T("CDataElementScopeItem::Create\n"));
  72. TRACEARGn(pScopePane);
  73. TRACEARGn(pParentItem);
  74. // call base class Create method
  75. if( ! CHMScopeItem::Create(pScopePane,pParentItem) )
  76. {
  77. TRACE(_T("CHMScopeItem::Create failed.\n"));
  78. return false;
  79. }
  80. for( int i = 0; i < HMS_MAX_STATES; i++ )
  81. {
  82. UINT nId = _Icons[i];
  83. m_IconResIds.Add(nId);
  84. m_OpenIconResIds.Add(nId);
  85. }
  86. SetIconIndex(HMS_NORMAL);
  87. SetOpenIconIndex(HMS_NORMAL);
  88. return true;
  89. }
  90. //////////////////////////////////////////////////////////////////////
  91. // Results Pane View Members
  92. //////////////////////////////////////////////////////////////////////
  93. CResultsPaneView* CDataElementScopeItem::CreateResultsPaneView()
  94. {
  95. TRACEX(_T("CDataElementScopeItem::CreateResultsPaneView\n"));
  96. return new CDataElementResultsView;
  97. }
  98. //////////////////////////////////////////////////////////////////////
  99. // MMC Notify Handlers
  100. //////////////////////////////////////////////////////////////////////
  101. HRESULT CDataElementScopeItem::OnAddMenuItems(LPCONTEXTMENUCALLBACK piCallback,long __RPC_FAR *pInsertionAllowed)
  102. {
  103. TRACEX(_T("CDataElementScopeItem::OnAddMenuItems\n"));
  104. TRACEARGn(piCallback);
  105. TRACEARGn(pInsertionAllowed);
  106. HRESULT hr = S_OK;
  107. // Add New Menu Items
  108. if( CCM_INSERTIONALLOWED_NEW & *pInsertionAllowed )
  109. {
  110. CONTEXTMENUITEM cmi;
  111. CString sResString;
  112. CString sResString2;
  113. sResString.LoadString(IDS_STRING_NEW_THRESHOLD);
  114. cmi.strName = LPTSTR(LPCTSTR(sResString));
  115. sResString2.LoadString(IDS_STRING_NEW_THRESHOLD_DESCRIPTION);
  116. cmi.strStatusBarText = LPTSTR(LPCTSTR(sResString2));
  117. cmi.lCommandID = IDM_NEW_RULE;
  118. cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_NEW;
  119. cmi.fFlags = 0;
  120. cmi.fSpecialFlags = 0;
  121. hr = piCallback->AddItem(&cmi);
  122. if( !SUCCEEDED(hr) )
  123. {
  124. TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
  125. return hr;
  126. }
  127. }
  128. // Add Task Menu Items
  129. if( CCM_INSERTIONALLOWED_TASK & *pInsertionAllowed )
  130. {
  131. CONTEXTMENUITEM cmi;
  132. CString sResString;
  133. CString sResString2;
  134. sResString.LoadString(IDS_STRING_CLEAR_EVENTS);
  135. cmi.strName = LPTSTR(LPCTSTR(sResString));
  136. sResString2.LoadString(IDS_STRING_CLEAR_EVENTS_DESCRIPTION);
  137. cmi.strStatusBarText = LPTSTR(LPCTSTR(sResString2));
  138. cmi.lCommandID = IDM_CLEAR_EVENTS;
  139. cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_TASK;
  140. cmi.fFlags = 0;
  141. cmi.fSpecialFlags = 0;
  142. hr = piCallback->AddItem(&cmi);
  143. if( !SUCCEEDED(hr) )
  144. {
  145. TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
  146. return hr;
  147. }
  148. // Reset Statistics
  149. sResString.LoadString(IDS_STRING_RESET_STATISTICS);
  150. cmi.strName = LPTSTR(LPCTSTR(sResString));
  151. sResString2.LoadString(IDS_STRING_RESET_STATISTICS_DESC);
  152. cmi.strStatusBarText = LPTSTR(LPCTSTR(sResString2));
  153. cmi.lCommandID = IDM_RESET_STATISTICS;
  154. cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_TASK;
  155. cmi.fFlags = 0;
  156. cmi.fSpecialFlags = 0;
  157. hr = piCallback->AddItem(&cmi);
  158. if( !SUCCEEDED(hr) )
  159. {
  160. TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
  161. return hr;
  162. }
  163. // v-marfin : 59675 : Moved these items up.
  164. // separator
  165. cmi.strName = NULL;
  166. cmi.strStatusBarText = NULL;
  167. cmi.lCommandID = NULL;
  168. cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_TASK;
  169. cmi.fFlags = MF_SEPARATOR;
  170. cmi.fSpecialFlags = 0;
  171. hr = piCallback->AddItem(&cmi);
  172. if( !SUCCEEDED(hr) )
  173. {
  174. TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
  175. return hr;
  176. }
  177. // Reset status
  178. sResString.LoadString(IDS_STRING_RESET_STATUS);
  179. cmi.strName = LPTSTR(LPCTSTR(sResString));
  180. sResString2.LoadString(IDS_STRING_RESET_STATUS_DESCRIPTION);
  181. cmi.strStatusBarText = LPTSTR(LPCTSTR(sResString2));
  182. cmi.lCommandID = IDM_RESET_STATUS;
  183. cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_TASK;
  184. cmi.fFlags = 0;
  185. cmi.fSpecialFlags = 0;
  186. hr = piCallback->AddItem(&cmi);
  187. if( !SUCCEEDED(hr) )
  188. {
  189. TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
  190. return hr;
  191. }
  192. // Check Now
  193. sResString.LoadString(IDS_STRING_CHECK_NOW);
  194. cmi.strName = LPTSTR(LPCTSTR(sResString));
  195. sResString2.LoadString(IDS_STRING_CHECK_NOW_DESC);
  196. cmi.strStatusBarText = LPTSTR(LPCTSTR(sResString2));
  197. cmi.lCommandID = IDM_CHECK_NOW;
  198. cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_TASK;
  199. cmi.fFlags = 0;
  200. cmi.fSpecialFlags = 0;
  201. hr = piCallback->AddItem(&cmi);
  202. if( !SUCCEEDED(hr) )
  203. {
  204. TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
  205. return hr;
  206. }
  207. // separator
  208. cmi.strName = NULL;
  209. cmi.strStatusBarText = NULL;
  210. cmi.lCommandID = NULL;
  211. cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_TASK;
  212. cmi.fFlags = MF_SEPARATOR;
  213. cmi.fSpecialFlags = 0;
  214. hr = piCallback->AddItem(&cmi);
  215. if( !SUCCEEDED(hr) )
  216. {
  217. TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
  218. return hr;
  219. }
  220. // Disabled
  221. sResString.LoadString(IDS_STRING_ENABLE_ALL_THRESHOLDS);
  222. cmi.strName = LPTSTR(LPCTSTR(sResString));
  223. sResString2.LoadString(IDS_STRING_ENABLE_ALL_THRESHOLDS_DESCRIPTION);
  224. cmi.strStatusBarText = LPTSTR(LPCTSTR(sResString2));
  225. cmi.lCommandID = IDM_DISABLE_MONITORING;
  226. cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_TASK;
  227. CHMObject* pObject = GetObjectPtr();
  228. CHMScopeItem* pParentItem = (CHMScopeItem*)GetParent();
  229. // disable menu item if null object ptr or parent is disabled
  230. if( ! pObject || (pParentItem && pParentItem->GetObjectPtr()
  231. && !pParentItem->GetObjectPtr()->IsEnabled()) )
  232. {
  233. cmi.fFlags = MF_DISABLED|MF_GRAYED;
  234. }
  235. else
  236. {
  237. int iState = pObject->IsEnabled();
  238. if( iState == -1 )
  239. {
  240. cmi.fFlags = MF_DISABLED|MF_GRAYED;
  241. }
  242. else if( iState == 0 )
  243. {
  244. cmi.fFlags = MF_CHECKED;
  245. }
  246. else if( iState == 1 )
  247. {
  248. cmi.fFlags = MF_UNCHECKED;
  249. }
  250. }
  251. cmi.fSpecialFlags = 0;
  252. hr = piCallback->AddItem(&cmi);
  253. if( !SUCCEEDED(hr) )
  254. {
  255. TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
  256. return hr;
  257. }
  258. }
  259. // Add View Menu Items
  260. if( CCM_INSERTIONALLOWED_VIEW & *pInsertionAllowed )
  261. {
  262. CONTEXTMENUITEM cmi;
  263. CString sResString;
  264. CString sResString2;
  265. sResString.LoadString(IDS_STRING_STATUS_ONLY);
  266. cmi.strName = LPTSTR(LPCTSTR(sResString));
  267. sResString2.LoadString(IDS_STRING_STATUS_ONLY_DESCRIPTION);
  268. cmi.strStatusBarText = LPTSTR(LPCTSTR(sResString2));
  269. cmi.lCommandID = IDM_STATUS_ONLY;
  270. cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_VIEW;
  271. cmi.fFlags = MF_UNCHECKED;
  272. cmi.fSpecialFlags = 0;
  273. hr = piCallback->AddItem(&cmi);
  274. if( !SUCCEEDED(hr) )
  275. {
  276. TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
  277. return hr;
  278. }
  279. sResString.LoadString(IDS_STRING_AUTO_FILTER);
  280. cmi.strName = LPTSTR(LPCTSTR(sResString));
  281. sResString2.LoadString(IDS_STRING_AUTO_FILTER_DESCRIPTION);
  282. cmi.strStatusBarText = LPTSTR(LPCTSTR(sResString2));
  283. cmi.lCommandID = IDM_AUTO_FILTER;
  284. cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_VIEW;
  285. cmi.fFlags = MF_CHECKED;
  286. cmi.fSpecialFlags = 0;
  287. hr = piCallback->AddItem(&cmi);
  288. if( !SUCCEEDED(hr) )
  289. {
  290. TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
  291. return hr;
  292. }
  293. // icon legend
  294. sResString.LoadString(IDS_STRING_ICON_LEGEND);
  295. cmi.strName = LPTSTR(LPCTSTR(sResString));
  296. sResString2.LoadString(IDS_STRING_ICON_LEGEND_DESCRIPTION);
  297. cmi.strStatusBarText = LPTSTR(LPCTSTR(sResString2));
  298. cmi.lCommandID = IDM_ICON_LEGEND;
  299. cmi.lInsertionPointID = CCM_INSERTIONPOINTID_PRIMARY_VIEW;
  300. cmi.fFlags = 0;
  301. cmi.fSpecialFlags = 0;
  302. hr = piCallback->AddItem(&cmi);
  303. if( !SUCCEEDED(hr) )
  304. {
  305. TRACE(_T("FAILED : IContextMenuCallback::AddItem failed.\n"));
  306. return hr;
  307. }
  308. }
  309. return hr;
  310. }
  311. HRESULT CDataElementScopeItem::OnCommand(long lCommandID)
  312. {
  313. TRACEX(_T("CDataElementScopeItem::OnCommand\n"));
  314. TRACEARGn(lCommandID);
  315. HRESULT hr = S_OK;
  316. switch(lCommandID)
  317. {
  318. case IDM_NEW_RULE:
  319. {
  320. CDataElement* pElement = (CDataElement*)GetObjectPtr();
  321. if( ! GfxCheckObjPtr(pElement,CDataElement) )
  322. {
  323. return E_FAIL;
  324. }
  325. pElement->CreateNewChildRule();
  326. }
  327. break;
  328. default:
  329. {
  330. hr = CHMScopeItem::OnCommand(lCommandID);
  331. }
  332. }
  333. return hr;
  334. }
  335. HRESULT CDataElementScopeItem::OnCreatePropertyPages(LPPROPERTYSHEETCALLBACK lpProvider, INT_PTR handle)
  336. {
  337. TRACEX(_T("CDataElementScopeItem::OnCreatePropertyPages\n"));
  338. TRACEARGn(lpProvider);
  339. TRACEARGn(handle);
  340. if( m_pScopePane == NULL )
  341. {
  342. return S_FALSE;
  343. }
  344. HRESULT hr = S_OK;
  345. CDataElement* pElement = (CDataElement*)GetObjectPtr();
  346. if( ! GfxCheckObjPtr(pElement,CDataElement) )
  347. {
  348. return E_FAIL;
  349. }
  350. // v-marfin bug 59643b : Make General Page the first page, but set
  351. // details page as the focus on a new data collector.
  352. CDPGeneralPage* pPage1 = new CDPGeneralPage;
  353. pPage1->SetObjectPtr(pElement);
  354. HPROPSHEETPAGE hPage1 = CreatePropertySheetPage( reinterpret_cast<LPCPROPSHEETPAGE>(&pPage1->m_psp) );
  355. hr = lpProvider->AddPage(hPage1);
  356. switch( pElement->GetType() )
  357. {
  358. case IDM_PERFMON:
  359. {
  360. CDPPerfMonPage* pPage2 = new CDPPerfMonPage;
  361. pPage2->SetObjectPtr(pElement);
  362. HPROPSHEETPAGE hPage2 = CreatePropertySheetPage( reinterpret_cast<LPCPROPSHEETPAGE>(&pPage2->m_psp) );
  363. hr = lpProvider->AddPage(hPage2);
  364. }
  365. break;
  366. case IDM_FILE_INFO:
  367. {
  368. CDPFileInfoPage* pPage2 = new CDPFileInfoPage;
  369. pPage2->SetObjectPtr(pElement);
  370. HPROPSHEETPAGE hPage2 = CreatePropertySheetPage( reinterpret_cast<LPCPROPSHEETPAGE>(&pPage2->m_psp) );
  371. hr = lpProvider->AddPage(hPage2);
  372. }
  373. break;
  374. case IDM_GENERIC_WMI_INSTANCE:
  375. {
  376. CDPWmiInstancePage* pPage2 = new CDPWmiInstancePage;
  377. pPage2->SetObjectPtr(pElement);
  378. HPROPSHEETPAGE hPage2 = CreatePropertySheetPage( reinterpret_cast<LPCPROPSHEETPAGE>(&pPage2->m_psp) );
  379. hr = lpProvider->AddPage(hPage2);
  380. }
  381. break;
  382. case IDM_GENERIC_WMI_QUERY:
  383. {
  384. CDPWmiQueryPage* pPage2 = new CDPWmiQueryPage;
  385. pPage2->SetObjectPtr(pElement);
  386. HPROPSHEETPAGE hPage2 = CreatePropertySheetPage( reinterpret_cast<LPCPROPSHEETPAGE>(&pPage2->m_psp) );
  387. hr = lpProvider->AddPage(hPage2);
  388. }
  389. break;
  390. case IDM_GENERIC_WMI_POLLED_QUERY:
  391. {
  392. CDPWmiPolledQueryPage* pPage2 = new CDPWmiPolledQueryPage;
  393. pPage2->SetObjectPtr(pElement);
  394. HPROPSHEETPAGE hPage2 = CreatePropertySheetPage( reinterpret_cast<LPCPROPSHEETPAGE>(&pPage2->m_psp) );
  395. hr = lpProvider->AddPage(hPage2);
  396. }
  397. break;
  398. case IDM_HTTP_ADDRESS:
  399. {
  400. CDPHttpPage* pPage2 = new CDPHttpPage;
  401. pPage2->SetObjectPtr(pElement);
  402. HPROPSHEETPAGE hPage2 = CreatePropertySheetPage( reinterpret_cast<LPCPROPSHEETPAGE>(&pPage2->m_psp) );
  403. hr = lpProvider->AddPage(hPage2);
  404. }
  405. break;
  406. case IDM_SERVICE:
  407. {
  408. CDPServicePage* pPage2 = new CDPServicePage;
  409. pPage2->SetObjectPtr(pElement);
  410. HPROPSHEETPAGE hPage2 = CreatePropertySheetPage( reinterpret_cast<LPCPROPSHEETPAGE>(&pPage2->m_psp) );
  411. hr = lpProvider->AddPage(hPage2);
  412. }
  413. break;
  414. case IDM_SNMP:
  415. {
  416. CDPSNMPDataPage* pPage2 = new CDPSNMPDataPage;
  417. pPage2->SetObjectPtr(pElement);
  418. HPROPSHEETPAGE hPage2 = CreatePropertySheetPage( reinterpret_cast<LPCPROPSHEETPAGE>(&pPage2->m_psp) );
  419. hr = lpProvider->AddPage(hPage2);
  420. }
  421. break;
  422. case IDM_NT_EVENTS:
  423. {
  424. CDPNtEventPage* pPage2 = new CDPNtEventPage;
  425. pPage2->SetObjectPtr(pElement);
  426. HPROPSHEETPAGE hPage2 = CreatePropertySheetPage( reinterpret_cast<LPCPROPSHEETPAGE>(&pPage2->m_psp) );
  427. hr = lpProvider->AddPage(hPage2);
  428. }
  429. break;
  430. case IDM_SMTP:
  431. {
  432. CDPSmtpPage* pPage2 = new CDPSmtpPage;
  433. pPage2->SetObjectPtr(pElement);
  434. HPROPSHEETPAGE hPage2 = CreatePropertySheetPage( reinterpret_cast<LPCPROPSHEETPAGE>(&pPage2->m_psp) );
  435. hr = lpProvider->AddPage(hPage2);
  436. }
  437. break;
  438. case IDM_FTP:
  439. {
  440. CDPFtpPage* pPage2 = new CDPFtpPage;
  441. pPage2->SetObjectPtr(pElement);
  442. HPROPSHEETPAGE hPage2 = CreatePropertySheetPage( reinterpret_cast<LPCPROPSHEETPAGE>(&pPage2->m_psp) );
  443. hr = lpProvider->AddPage(hPage2);
  444. }
  445. break;
  446. case IDM_ICMP:
  447. {
  448. CDPIcmpPage* pPage2 = new CDPIcmpPage;
  449. pPage2->SetObjectPtr(pElement);
  450. HPROPSHEETPAGE hPage2 = CreatePropertySheetPage( reinterpret_cast<LPCPROPSHEETPAGE>(&pPage2->m_psp) );
  451. hr = lpProvider->AddPage(hPage2);
  452. }
  453. break;
  454. case IDM_COM_PLUS:
  455. {
  456. CDPComPlusPage* pPage2 = new CDPComPlusPage;
  457. pPage2->SetObjectPtr(pElement);
  458. HPROPSHEETPAGE hPage2 = CreatePropertySheetPage( reinterpret_cast<LPCPROPSHEETPAGE>(&pPage2->m_psp) );
  459. hr = lpProvider->AddPage(hPage2);
  460. }
  461. break;
  462. }
  463. CActionAssociationPage* pPage3 = new CActionAssociationPage;
  464. //---------------------------------------------------------------------------------------------
  465. // v-marfin 62192 : by default the action property page will load its threshold action help.
  466. // so we will override since this is a data group being shown properties, not
  467. // a threshold.
  468. // v-marfin 62515 : This is a data collector so use its help instead of the data group
  469. pPage3->m_sHelpTopic = _T("HMon21.chm::/dDCact.htm");
  470. //----------------------------------------------------------------------------------------------
  471. pPage3->SetObjectPtr(GetObjectPtr());
  472. HPROPSHEETPAGE hPage3 = CreatePropertySheetPage( reinterpret_cast<LPCPROPSHEETPAGE>(&pPage3->m_psp) );
  473. hr = lpProvider->AddPage(hPage3);
  474. CDPSchedulePage* pPage4 = new CDPSchedulePage;
  475. pPage4->SetObjectPtr(pElement);
  476. HPROPSHEETPAGE hPage4 = CreatePropertySheetPage( reinterpret_cast<LPCPROPSHEETPAGE>(&pPage4->m_psp) );
  477. hr = lpProvider->AddPage(hPage4);
  478. return hr;
  479. }
  480. HRESULT CDataElementScopeItem::OnSelect(CResultsPane* pPane, BOOL bSelected)
  481. {
  482. TRACEX(_T("CDataElementScopeItem::OnSelect\n"));
  483. TRACEARGn(pPane);
  484. TRACEARGn(bSelected);
  485. if( ! CHECKHRESULT(CHMScopeItem::OnSelect(pPane,bSelected)) )
  486. {
  487. TRACE(_T("FAILED : CHMScopeItem::OnSelect returns failure.\n"));
  488. return E_FAIL;
  489. }
  490. if( ! bSelected ) // we are being de-selected so do not do anything
  491. {
  492. return S_OK;
  493. }
  494. LPCONSOLEVERB lpConsoleVerb = pPane->GetConsoleVerbPtr();
  495. HRESULT hr = lpConsoleVerb->SetVerbState( MMC_VERB_PROPERTIES, ENABLED, TRUE );
  496. if( ! CHECKHRESULT(hr) )
  497. {
  498. TRACE(_T("FAILED : IConsoleVerb::SetVerbState failed.\n"));
  499. lpConsoleVerb->Release();
  500. return hr;
  501. }
  502. hr = lpConsoleVerb->SetVerbState( MMC_VERB_RENAME, ENABLED, TRUE );
  503. if( ! CHECKHRESULT(hr) )
  504. {
  505. TRACE(_T("FAILED : IConsoleVerb::SetVerbState failed.\n"));
  506. lpConsoleVerb->Release();
  507. return hr;
  508. }
  509. hr = lpConsoleVerb->SetVerbState( MMC_VERB_CUT, ENABLED, TRUE );
  510. if( ! CHECKHRESULT(hr) )
  511. {
  512. TRACE(_T("FAILED : IConsoleVerb::SetVerbState failed.\n"));
  513. lpConsoleVerb->Release();
  514. return hr;
  515. }
  516. hr = lpConsoleVerb->SetVerbState( MMC_VERB_COPY, ENABLED, TRUE );
  517. if( ! CHECKHRESULT(hr) )
  518. {
  519. TRACE(_T("FAILED : IConsoleVerb::SetVerbState failed.\n"));
  520. lpConsoleVerb->Release();
  521. return hr;
  522. }
  523. hr = lpConsoleVerb->SetVerbState( MMC_VERB_PASTE, ENABLED, TRUE );
  524. if( ! CHECKHRESULT(hr) )
  525. {
  526. TRACE(_T("FAILED : IConsoleVerb::SetVerbState failed.\n"));
  527. lpConsoleVerb->Release();
  528. return hr;
  529. }
  530. hr = lpConsoleVerb->SetVerbState( MMC_VERB_DELETE, ENABLED, TRUE );
  531. if( ! CHECKHRESULT(hr) )
  532. {
  533. TRACE(_T("FAILED : IConsoleVerb::SetVerbState failed.\n"));
  534. lpConsoleVerb->Release();
  535. return hr;
  536. }
  537. lpConsoleVerb->Release();
  538. return hr;
  539. }