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.

2842 lines
51 KiB

  1. /*++
  2. Copyright (C) 1993-1999 Microsoft Corporation
  3. Module Name:
  4. control.cpp
  5. Abstract:
  6. Implementation of ISystemMonitor, IOleControl, ISpecifyPP,
  7. IProvideClassInfo interfaces.
  8. --*/
  9. #include "polyline.h"
  10. #include "unkhlpr.h"
  11. #include "unihelpr.h"
  12. #include "ctrprop.h"
  13. #include "grphprop.h"
  14. #include "genprop.h"
  15. #include "appearprop.h"
  16. #include "logsrc.h"
  17. #include "srcprop.h"
  18. //----------------------------------------------------------------------------
  19. // CImpISpecifyPP Interface Implementation
  20. //----------------------------------------------------------------------------
  21. // Standard IUnknown for contained interface
  22. IMPLEMENT_CONTAINED_INTERFACE(CPolyline, CImpISpecifyPP)
  23. STDMETHODIMP
  24. CImpISpecifyPP::GetPages (
  25. OUT CAUUID *pPages
  26. )
  27. /*++
  28. Routine Description:
  29. GetPages returns an allocated array of property page GUIDs for Sysmon graph.
  30. There are three pages: general, graph, and counter.
  31. Arguments:
  32. pPages - Pointer to GUID array header filled in by this routine
  33. Return Value:
  34. HRESULT - NOERROR or OUT_OF_MEMORY
  35. --*/
  36. {
  37. HRESULT hr = E_POINTER;
  38. IMalloc *pIMalloc = NULL;
  39. GUID *pGUID = NULL;
  40. if ( NULL != pPages ) {
  41. pPages->cElems = 0;
  42. pPages->pElems = NULL;
  43. // Get Ole Malloc and allocate array
  44. if ( FAILED(CoGetMalloc(MEMCTX_TASK, &pIMalloc)) )
  45. return E_OUTOFMEMORY;
  46. pGUID = (GUID*)pIMalloc->Alloc((CPROPPAGES) * sizeof(GUID));
  47. if (NULL != pGUID) {
  48. // Fill the structure
  49. pGUID[GENERAL_PROPPAGE] = CLSID_GeneralPropPage;
  50. pGUID[SOURCE_PROPPAGE] = CLSID_SourcePropPage;
  51. pGUID[COUNTER_PROPPAGE] = CLSID_CounterPropPage;
  52. pGUID[GRAPH_PROPPAGE] = CLSID_GraphPropPage;
  53. pGUID[APPEAR_PROPPAGE] = CLSID_AppearPropPage;
  54. pPages->cElems = CPROPPAGES;
  55. pPages->pElems = pGUID;
  56. }
  57. pIMalloc->Release();
  58. hr = (NULL != pGUID) ? NOERROR : E_OUTOFMEMORY;
  59. }
  60. return hr;
  61. }
  62. //----------------------------------------------------------------------------
  63. // CImpIProvideClassInfo Interface Implementation
  64. //----------------------------------------------------------------------------
  65. // Standard IUnknown for contained interface
  66. IMPLEMENT_CONTAINED_INTERFACE(CPolyline, CImpIProvideClassInfo)
  67. STDMETHODIMP
  68. CImpIProvideClassInfo::GetClassInfo (
  69. OUT LPTYPEINFO *ppTI
  70. )
  71. /*++
  72. Routine Description:
  73. GetClassInfo returns an ITypeInfo interface to its type lib information.
  74. The interface is obtained by querying the contained ITypeLib interface.
  75. Arguments:
  76. ppTI - Pointer to returned ITypeInfo interface
  77. Return Value:
  78. HRESULT
  79. --*/
  80. {
  81. if (NULL == ppTI)
  82. return E_POINTER;
  83. *ppTI = NULL;
  84. return m_pObj->m_pITypeLib->GetTypeInfoOfGuid(CLSID_SystemMonitor, ppTI);
  85. }
  86. //----------------------------------------------------------------------------
  87. // CImpISystemMonitor Interface Implementation
  88. //----------------------------------------------------------------------------
  89. // Standard IUnknown for contained interface
  90. IMPLEMENT_CONTAINED_INTERFACE(CPolyline, CImpISystemMonitor)
  91. STDMETHODIMP
  92. CImpISystemMonitor::put_Appearance (
  93. IN INT iAppearance
  94. )
  95. {
  96. HRESULT hr = E_INVALIDARG;
  97. // 0 = Flat, 1 = 3D
  98. if ( ( 0 == iAppearance ) || ( 1 == iAppearance ) ) {
  99. m_pObj->m_pCtrl->put_Appearance( iAppearance, FALSE );
  100. hr = NOERROR;
  101. }
  102. return hr;
  103. }
  104. STDMETHODIMP
  105. CImpISystemMonitor::get_Appearance (
  106. OUT INT *piAppearance
  107. )
  108. {
  109. HRESULT hr = E_POINTER;
  110. if ( NULL != piAppearance ) {
  111. *piAppearance = m_pObj->m_Graph.Options.iAppearance;
  112. if (*piAppearance == NULL_APPEARANCE)
  113. *piAppearance = m_pObj->m_pCtrl->Appearance();
  114. hr = NOERROR;
  115. }
  116. return hr;
  117. }
  118. STDMETHODIMP
  119. CImpISystemMonitor::put_BackColor (
  120. IN OLE_COLOR Color
  121. )
  122. {
  123. m_pObj->m_pCtrl->put_BackPlotColor(Color, FALSE);
  124. return NOERROR;
  125. }
  126. STDMETHODIMP
  127. CImpISystemMonitor::get_BackColor (
  128. OUT OLE_COLOR *pColor
  129. )
  130. {
  131. HRESULT hr = E_POINTER;
  132. if ( NULL != pColor ) {
  133. *pColor = m_pObj->m_Graph.Options.clrBackPlot;
  134. if (*pColor == NULL_COLOR)
  135. *pColor = m_pObj->m_pCtrl->clrBackPlot();
  136. hr = NOERROR;
  137. }
  138. return hr;
  139. }
  140. STDMETHODIMP
  141. CImpISystemMonitor::put_BackColorCtl (
  142. IN OLE_COLOR Color
  143. )
  144. {
  145. m_pObj->m_pCtrl->put_BackCtlColor(Color);
  146. return NOERROR;
  147. }
  148. STDMETHODIMP
  149. CImpISystemMonitor::get_BackColorCtl (
  150. OUT OLE_COLOR *pColor
  151. )
  152. {
  153. HRESULT hr = E_POINTER;
  154. if ( NULL != pColor ) {
  155. // NT 5.0 Beta 1 files can be saved with NULL BackColorCtl.
  156. *pColor = m_pObj->m_Graph.Options.clrBackCtl;
  157. if (*pColor == NULL_COLOR)
  158. *pColor = m_pObj->m_pCtrl->clrBackCtl();
  159. hr = NOERROR;
  160. }
  161. return hr;
  162. }
  163. STDMETHODIMP
  164. CImpISystemMonitor::put_GridColor (
  165. IN OLE_COLOR Color
  166. )
  167. {
  168. m_pObj->m_pCtrl->put_GridColor(Color);
  169. return NOERROR;
  170. }
  171. STDMETHODIMP
  172. CImpISystemMonitor::get_GridColor (
  173. OUT OLE_COLOR *pColor
  174. )
  175. {
  176. HRESULT hr = E_POINTER;
  177. if ( NULL != pColor ) {
  178. *pColor = m_pObj->m_Graph.Options.clrGrid;
  179. hr = NOERROR;
  180. }
  181. return hr;
  182. }
  183. STDMETHODIMP
  184. CImpISystemMonitor::put_TimeBarColor (
  185. IN OLE_COLOR Color )
  186. {
  187. m_pObj->m_pCtrl->put_TimeBarColor(Color);
  188. return NOERROR;
  189. }
  190. STDMETHODIMP
  191. CImpISystemMonitor::get_TimeBarColor (
  192. OUT OLE_COLOR *pColor )
  193. {
  194. HRESULT hr = E_POINTER;
  195. if ( NULL != pColor ) {
  196. *pColor = m_pObj->m_Graph.Options.clrTimeBar;
  197. hr = NOERROR;
  198. }
  199. return hr;
  200. }
  201. STDMETHODIMP
  202. CImpISystemMonitor::put_BorderStyle (
  203. IN INT iBorderStyle
  204. )
  205. {
  206. HRESULT hr;
  207. // 0 = none, 1 = single.
  208. if ( ( 0 == iBorderStyle ) || ( 1 == iBorderStyle ) ) {
  209. m_pObj->m_pCtrl->put_BorderStyle( iBorderStyle, FALSE );
  210. hr = NOERROR;
  211. } else {
  212. hr = E_INVALIDARG;
  213. }
  214. return hr;
  215. }
  216. STDMETHODIMP
  217. CImpISystemMonitor::get_BorderStyle (
  218. OUT INT *piBorderStyle
  219. )
  220. {
  221. HRESULT hr = E_POINTER;
  222. if ( NULL != piBorderStyle ) {
  223. *piBorderStyle = m_pObj->m_Graph.Options.iBorderStyle;
  224. if (*piBorderStyle == NULL_BORDERSTYLE)
  225. *piBorderStyle = m_pObj->m_pCtrl->BorderStyle();
  226. hr = NOERROR;
  227. }
  228. return hr;
  229. }
  230. STDMETHODIMP
  231. CImpISystemMonitor::put_ForeColor (
  232. IN OLE_COLOR Color
  233. )
  234. {
  235. m_pObj->m_pCtrl->put_FgndColor(Color, FALSE);
  236. return NOERROR;
  237. }
  238. STDMETHODIMP
  239. CImpISystemMonitor::get_ForeColor (
  240. OUT OLE_COLOR *pColor
  241. )
  242. {
  243. HRESULT hr = E_POINTER;
  244. if ( NULL != pColor ) {
  245. *pColor = m_pObj->m_Graph.Options.clrFore;
  246. if (*pColor == NULL_COLOR)
  247. *pColor = m_pObj->m_pCtrl->clrFgnd();
  248. hr = NOERROR;
  249. }
  250. return hr;
  251. }
  252. STDMETHODIMP
  253. CImpISystemMonitor::putref_Font (
  254. IN IFontDisp *pFontDisp
  255. )
  256. {
  257. LPFONT pIFont;
  258. HRESULT hr;
  259. if ( NULL == pFontDisp ) {
  260. hr = E_POINTER;
  261. } else {
  262. hr = pFontDisp->QueryInterface(IID_IFont, (PPVOID)&pIFont);
  263. if (SUCCEEDED(hr)) {
  264. hr = m_pObj->m_pCtrl->put_Font ( pIFont, FALSE );
  265. }
  266. pIFont->Release();
  267. }
  268. return hr;
  269. }
  270. STDMETHODIMP
  271. CImpISystemMonitor::get_Font (
  272. OUT IFontDisp **ppFont
  273. )
  274. {
  275. HRESULT hr = E_POINTER;
  276. if ( NULL != ppFont ) {
  277. hr = m_pObj->m_pCtrl->m_OleFont.GetFontDisp(ppFont);
  278. }
  279. return hr;
  280. }
  281. STDMETHODIMP
  282. CImpISystemMonitor::put_ShowVerticalGrid (
  283. IN VARIANT_BOOL bVisible
  284. )
  285. /*++
  286. Routine Description:
  287. Shows/hides the vertical grid.
  288. Arguments:
  289. bVisible - Visibility (TRUE = show, FALSE = hide)
  290. Return Value:
  291. HRESULT
  292. --*/
  293. {
  294. m_pObj->m_Graph.Options.bVertGridChecked = bVisible;
  295. m_pObj->m_pCtrl->UpdateGraph(UPDGRPH_PLOT);
  296. return NOERROR;
  297. }
  298. STDMETHODIMP
  299. CImpISystemMonitor::get_ShowVerticalGrid (
  300. OUT VARIANT_BOOL *pbState
  301. )
  302. /*++
  303. Routine Description:
  304. Gets the vertical grid visibility state.
  305. Arguments:
  306. pbState - pointer to returned state (TRUE = visible, FALSE = hidden)
  307. Return Value:
  308. HRESULT
  309. --*/
  310. {
  311. HRESULT hr = E_POINTER;
  312. if ( NULL != pbState ) {
  313. *pbState = (short)m_pObj->m_Graph.Options.bVertGridChecked;
  314. hr = NOERROR;
  315. }
  316. return hr;
  317. }
  318. STDMETHODIMP
  319. CImpISystemMonitor::put_ShowHorizontalGrid(
  320. IN VARIANT_BOOL bVisible
  321. )
  322. /*++
  323. Routine Description:
  324. Shows/hides the horizontal grid.
  325. Arguments:
  326. bVisible - Visibility (TRUE = show, FALSE = hide)
  327. Return Value:
  328. HRESULT
  329. --*/
  330. {
  331. m_pObj->m_Graph.Options.bHorzGridChecked = bVisible;
  332. m_pObj->m_pCtrl->UpdateGraph(UPDGRPH_PLOT);
  333. return NOERROR;
  334. }
  335. STDMETHODIMP
  336. CImpISystemMonitor::get_ShowHorizontalGrid (
  337. OUT VARIANT_BOOL *pbState
  338. )
  339. /*++
  340. Routine Description:
  341. Gets the horizontal grid visibility state.
  342. Arguments:
  343. pbState - pointer to returned state (TRUE = visible, FALSE = hidden)
  344. Return Value:
  345. HRESULT
  346. --*/
  347. {
  348. HRESULT hr = E_POINTER;
  349. if ( NULL != pbState ) {
  350. *pbState = (short)m_pObj->m_Graph.Options.bHorzGridChecked;
  351. hr = NOERROR;
  352. }
  353. return hr;
  354. }
  355. STDMETHODIMP
  356. CImpISystemMonitor::put_Highlight(
  357. IN VARIANT_BOOL bState
  358. )
  359. /*++
  360. Routine Description:
  361. Sets the highlight state. If true, the selected counter is
  362. always highlighted in the graph.
  363. Arguments:
  364. bState - Highlight (TRUE = highlight, FALSE = no highlight)
  365. Return Value:
  366. HRESULT
  367. --*/
  368. {
  369. m_pObj->m_pCtrl->put_Highlight(bState);
  370. return NOERROR;
  371. }
  372. STDMETHODIMP
  373. CImpISystemMonitor::get_Highlight (
  374. OUT VARIANT_BOOL *pbState
  375. )
  376. /*++
  377. Routine Description:
  378. Gets the highlight state.
  379. Arguments:
  380. pbState - pointer to returned state (TRUE = highlight, FALSE = no highlight)
  381. Return Value:
  382. HRESULT
  383. --*/
  384. {
  385. HRESULT hr = E_POINTER;
  386. if ( NULL != pbState ) {
  387. *pbState = (short)m_pObj->m_Graph.Options.bHighlight;
  388. hr = NOERROR;
  389. }
  390. return hr;
  391. }
  392. STDMETHODIMP
  393. CImpISystemMonitor::put_ShowLegend (
  394. IN VARIANT_BOOL bState
  395. )
  396. /*++
  397. Routine Description:
  398. Shows/hides the graph legend.
  399. Arguments:
  400. bVisible - Visibility (TRUE = show, FALSE = hide)
  401. Return Value:
  402. HRESULT
  403. --*/
  404. {
  405. m_pObj->m_Graph.Options.bLegendChecked = bState;
  406. m_pObj->m_pCtrl->UpdateGraph(UPDGRPH_LAYOUT);
  407. return NOERROR;
  408. }
  409. STDMETHODIMP
  410. CImpISystemMonitor::get_ShowLegend (
  411. OUT VARIANT_BOOL *pbState
  412. )
  413. /*++
  414. Routine Description:
  415. Gets the legend visibility state.
  416. Arguments:
  417. pbState - pointer to returned state (TRUE = visible, FALSE = hidden)
  418. Return Value:
  419. HRESULT
  420. --*/
  421. {
  422. HRESULT hr = E_POINTER;
  423. if ( NULL != pbState ) {
  424. *pbState = (short)m_pObj->m_Graph.Options.bLegendChecked;
  425. hr = NOERROR;
  426. }
  427. return hr;
  428. }
  429. STDMETHODIMP
  430. CImpISystemMonitor::put_ShowToolbar (
  431. IN VARIANT_BOOL bState
  432. )
  433. /*++
  434. Routine Description:
  435. Shows/hides the graph toolbar
  436. Arguments:
  437. bState = Visibility (TRUE = show, FALSE = hide)
  438. Return Value:
  439. HRESULT
  440. --*/
  441. {
  442. m_pObj->m_Graph.Options.bToolbarChecked = bState;
  443. m_pObj->m_pCtrl->UpdateGraph(UPDGRPH_LAYOUT);
  444. return NOERROR;
  445. }
  446. STDMETHODIMP
  447. CImpISystemMonitor::get_ShowToolbar (
  448. OUT VARIANT_BOOL *pbState
  449. )
  450. /*++
  451. Routine Description:
  452. Gets the legend visibility state.
  453. Arguments:
  454. pbState - pointer to returned state (TRUE = visible, FALSE = hidden)
  455. Return Value:
  456. HRESULT
  457. --*/
  458. {
  459. HRESULT hr = E_POINTER;
  460. if ( NULL != pbState ) {
  461. *pbState = (short)m_pObj->m_Graph.Options.bToolbarChecked;
  462. hr = NOERROR;
  463. }
  464. return hr;
  465. }
  466. STDMETHODIMP
  467. CImpISystemMonitor::put_ShowScaleLabels (
  468. IN VARIANT_BOOL bState
  469. )
  470. /*++
  471. Routine Description:
  472. Shows/hides the vertical scale numbers.
  473. Arguments:
  474. bVisible - Visibility (TRUE = show, FALSE = hide)
  475. Return Value:
  476. HRESULT
  477. --*/
  478. {
  479. m_pObj->m_Graph.Options.bLabelsChecked = bState;
  480. m_pObj->m_pCtrl->UpdateGraph(UPDGRPH_LAYOUT);
  481. return NOERROR;
  482. }
  483. STDMETHODIMP
  484. CImpISystemMonitor::get_ShowScaleLabels (
  485. OUT VARIANT_BOOL *pbState
  486. )
  487. /*++
  488. Routine Description:
  489. Gets the visibility state of the vertical scale numbers.
  490. Arguments:
  491. pbState - pointer to returned state (TRUE = visible, FALSE = hidden)
  492. Return Value:
  493. HRESULT
  494. --*/
  495. {
  496. HRESULT hr = E_POINTER;
  497. if ( NULL != pbState ) {
  498. *pbState = (short)m_pObj->m_Graph.Options.bLabelsChecked;
  499. hr = NOERROR;
  500. }
  501. return hr;
  502. }
  503. STDMETHODIMP
  504. CImpISystemMonitor::put_ShowValueBar (
  505. IN VARIANT_BOOL bState
  506. )
  507. /*++
  508. Routine Description:
  509. Shows/hides the graph statistics bar.
  510. Arguments:
  511. bVisible - Visibility (TRUE = show, FALSE = hide)
  512. Return Value:
  513. HRESULT
  514. --*/
  515. {
  516. m_pObj->m_Graph.Options.bValueBarChecked = bState;
  517. m_pObj->m_pCtrl->UpdateGraph(UPDGRPH_LAYOUT);
  518. return NOERROR;
  519. }
  520. STDMETHODIMP
  521. CImpISystemMonitor::get_ShowValueBar(
  522. OUT VARIANT_BOOL *pbState
  523. )
  524. /*++
  525. Routine Description:
  526. Gets the statistics bar visibility state.
  527. Arguments:
  528. pbState - pointer to returned state (TRUE = visible, FALSE = hidden)
  529. Return Value:
  530. HRESULT
  531. --*/
  532. {
  533. HRESULT hr = E_POINTER;
  534. if ( NULL != pbState ) {
  535. *pbState = (short)m_pObj->m_Graph.Options.bValueBarChecked;
  536. hr = NOERROR;
  537. }
  538. return hr;
  539. }
  540. STDMETHODIMP
  541. CImpISystemMonitor::put_MaximumScale (
  542. IN INT iValue
  543. )
  544. /*++
  545. Routine Description:
  546. Sets the vertical scale maximum value.
  547. Arguments:
  548. iValue - Maximum value
  549. Return Value:
  550. HRESULT
  551. --*/
  552. {
  553. if ( ( iValue <= MAX_VERTICAL_SCALE ) && (iValue > m_pObj->m_Graph.Options.iVertMin ) ) {
  554. m_pObj->m_Graph.Options.iVertMax = iValue;
  555. m_pObj->m_Graph.Scale.SetMaxValue(iValue);
  556. m_pObj->m_pCtrl->UpdateGraph(UPDGRPH_LAYOUT);
  557. return NOERROR;
  558. } else {
  559. return E_INVALIDARG;
  560. }
  561. }
  562. STDMETHODIMP
  563. CImpISystemMonitor::get_MaximumScale (
  564. OUT INT *piValue
  565. )
  566. /*++
  567. Routine Description:
  568. Gets the vertical scale's maximum value.
  569. Arguments:
  570. piValue = pointer to returned value
  571. Return Value:
  572. HRESULT
  573. --*/
  574. {
  575. HRESULT hr = E_POINTER;
  576. if ( NULL != piValue ) {
  577. *piValue = m_pObj->m_Graph.Options.iVertMax;
  578. hr = NOERROR;
  579. }
  580. return hr;
  581. }
  582. STDMETHODIMP
  583. CImpISystemMonitor::put_MinimumScale (
  584. IN INT iValue
  585. )
  586. /*++
  587. Routine Description:
  588. Sets the vertical scale minimum value.
  589. Arguments:
  590. iValue - Minimum value
  591. Return Value:
  592. None.
  593. --*/
  594. {
  595. if ( ( iValue >= MIN_VERTICAL_SCALE ) && (iValue < m_pObj->m_Graph.Options.iVertMax ) ) {
  596. m_pObj->m_Graph.Options.iVertMin = iValue;
  597. m_pObj->m_Graph.Scale.SetMinValue(iValue);
  598. m_pObj->m_pCtrl->UpdateGraph(UPDGRPH_LAYOUT);
  599. return NOERROR;
  600. } else {
  601. return E_INVALIDARG;
  602. }
  603. }
  604. STDMETHODIMP
  605. CImpISystemMonitor::get_MinimumScale (
  606. OUT INT *piValue
  607. )
  608. /*++
  609. Routine Description:
  610. Gets the vertical scale's minimum value.
  611. Arguments:
  612. piValue = pointer to returned value
  613. Return Value:
  614. HRESULT
  615. --*/
  616. {
  617. HRESULT hr = E_POINTER;
  618. if ( NULL != piValue ) {
  619. *piValue = m_pObj->m_Graph.Options.iVertMin;
  620. hr = NOERROR;
  621. }
  622. return hr;
  623. }
  624. STDMETHODIMP
  625. CImpISystemMonitor::put_UpdateInterval (
  626. IN FLOAT fValue
  627. )
  628. /*++
  629. Routine Description:
  630. Sets the graph sample interval.
  631. Arguments:
  632. fValue - Update interval in seconds (can be fraction)
  633. Return Value:
  634. HRESULT
  635. --*/
  636. {
  637. if ( ( fValue >= MIN_UPDATE_INTERVAL ) && (fValue <= MAX_UPDATE_INTERVAL ) ) {
  638. m_pObj->m_Graph.Options.fUpdateInterval = fValue;
  639. m_pObj->m_pCtrl->SetIntervalTimer();
  640. return NOERROR;
  641. } else {
  642. return E_INVALIDARG;
  643. }
  644. }
  645. STDMETHODIMP
  646. CImpISystemMonitor::get_UpdateInterval (
  647. OUT FLOAT *pfValue
  648. )
  649. /*++
  650. Routine Description:
  651. Gets the graph's sample interval measured in seconds.
  652. Arguments:
  653. pfValue = pointer to returned value
  654. Return Value:
  655. HRESULT
  656. --*/
  657. {
  658. HRESULT hr = E_POINTER;
  659. if ( NULL != pfValue ) {
  660. *pfValue = m_pObj->m_Graph.Options.fUpdateInterval;
  661. hr = NOERROR;
  662. }
  663. return hr;
  664. }
  665. STDMETHODIMP
  666. CImpISystemMonitor::put_DisplayFilter (
  667. IN INT iValue
  668. )
  669. /*++
  670. Routine Description:
  671. Sets the graph display filter - samples per display interval.
  672. Arguments:
  673. iValue - Update interval in samples
  674. Return Value:
  675. HRESULT
  676. --*/
  677. {
  678. if ( iValue > 0 ) {
  679. // TodoDisplayFilter: Support for display filter > sample filter.
  680. if ( 1 == iValue ) {
  681. // TodoDisplayFilter: Display filter units = seconds instead of samples
  682. m_pObj->m_Graph.Options.iDisplayFilter = iValue;
  683. // m_pObj->m_pCtrl->SetIntervalTimer();
  684. return NOERROR;
  685. } else {
  686. return E_INVALIDARG;
  687. }
  688. } else {
  689. return E_INVALIDARG;
  690. }
  691. }
  692. STDMETHODIMP
  693. CImpISystemMonitor::get_DisplayFilter (
  694. OUT INT *piValue
  695. )
  696. /*++
  697. Routine Description:
  698. Gets the graph's display interval measured in samples.
  699. Arguments:
  700. piValue = pointer to returned value
  701. Return Value:
  702. HRESULT
  703. --*/
  704. {
  705. HRESULT hr = E_POINTER;
  706. if ( NULL != piValue ) {
  707. *piValue = m_pObj->m_Graph.Options.iDisplayFilter;
  708. hr = NOERROR;
  709. }
  710. return hr;
  711. }
  712. STDMETHODIMP
  713. CImpISystemMonitor::put_DisplayType (
  714. IN eDisplayTypeConstant eDisplayType
  715. )
  716. /*++
  717. Routine Description:
  718. Selects display type (1 = line plot, 2 = histogram, 3 = Report)
  719. Arguments:
  720. eDisplayType - Display type
  721. Return Value:
  722. HRESULT
  723. --*/
  724. {
  725. INT iUpdate;
  726. if (eDisplayType < LINE_GRAPH || eDisplayType > REPORT_GRAPH)
  727. return E_INVALIDARG;
  728. if (m_pObj->m_Graph.Options.iDisplayType == REPORT_GRAPH ||
  729. eDisplayType == REPORT_GRAPH)
  730. iUpdate = UPDGRPH_VIEW;
  731. else
  732. iUpdate = UPDGRPH_PLOT;
  733. m_pObj->m_Graph.Options.iDisplayType = eDisplayType;
  734. m_pObj->m_pCtrl->UpdateGraph(iUpdate);
  735. return NOERROR;
  736. }
  737. STDMETHODIMP
  738. CImpISystemMonitor::get_DisplayType (
  739. OUT eDisplayTypeConstant *peDisplayType
  740. )
  741. /*++
  742. Routine Description:
  743. Get graph display type (1 = line plot, 2 = histogram, 3 = Report)
  744. Arguments:
  745. peDisplayType = pointer to returned value
  746. Return Value:
  747. HRESULT
  748. --*/
  749. {
  750. HRESULT hr = E_POINTER;
  751. if ( NULL != peDisplayType ) {
  752. *peDisplayType = (eDisplayTypeConstant)m_pObj->m_Graph.Options.iDisplayType;
  753. hr = NOERROR;
  754. }
  755. return hr;
  756. }
  757. STDMETHODIMP
  758. CImpISystemMonitor::put_ManualUpdate (
  759. IN VARIANT_BOOL bMode
  760. )
  761. /*++
  762. Routine Description:
  763. Sets/clears manual update mode. Manual mode suspends periodic updates
  764. of the graph.
  765. Arguments:
  766. bMode - Manual mode (TRUE = On, FALSE = Off)
  767. Return Value:
  768. HRESULT
  769. --*/
  770. {
  771. m_pObj->m_pCtrl->put_ManualUpdate ( bMode );
  772. return NOERROR;
  773. }
  774. STDMETHODIMP
  775. CImpISystemMonitor::get_ManualUpdate (
  776. OUT VARIANT_BOOL *pbState
  777. )
  778. /*++
  779. Routine Description:
  780. Gets manual update mode.
  781. Arguments:
  782. pbState = pointer to returned state (TRUE = On, FALSE = Off)
  783. Return Value:
  784. HRESULT
  785. --*/
  786. {
  787. HRESULT hr = E_POINTER;
  788. if ( NULL != pbState ) {
  789. *pbState = (short)m_pObj->m_Graph.Options.bManualUpdate;
  790. hr = NOERROR;
  791. }
  792. return hr;
  793. }
  794. STDMETHODIMP
  795. CImpISystemMonitor::put_GraphTitle (
  796. IN BSTR bstrTitle
  797. )
  798. /*++
  799. Routine Description:
  800. Sets the graph title.
  801. Arguments:
  802. bstrTitle - Title string
  803. Return Value:
  804. HRESULT
  805. --*/
  806. {
  807. LPTSTR pszTemp;
  808. LPTSTR pszTitle;
  809. USES_CONVERSION
  810. if ( (bstrTitle == NULL) || (bstrTitle[0] == 0) ) {
  811. delete m_pObj->m_Graph.Options.pszGraphTitle;
  812. m_pObj->m_Graph.Options.pszGraphTitle = NULL;
  813. }
  814. else {
  815. pszTemp = W2T(bstrTitle);
  816. pszTitle = new TCHAR [lstrlen(pszTemp) + 1];
  817. if (pszTitle) {
  818. lstrcpy(pszTitle, pszTemp);
  819. delete m_pObj->m_Graph.Options.pszGraphTitle;
  820. m_pObj->m_Graph.Options.pszGraphTitle = pszTitle;
  821. }
  822. else {
  823. return E_OUTOFMEMORY;
  824. }
  825. }
  826. m_pObj->m_pCtrl->UpdateGraph(UPDGRPH_LAYOUT);
  827. return NOERROR;
  828. }
  829. STDMETHODIMP
  830. CImpISystemMonitor::get_GraphTitle (
  831. BSTR *pbsTitle
  832. )
  833. /*++
  834. Routine Description:
  835. Gets the graph title string. The caller is responsible for releasing the
  836. string memory.
  837. Arguments:
  838. pbsTitle - pointer to returned title (BSTR)
  839. Return Value:
  840. HResult
  841. --*/
  842. {
  843. HRESULT hr = E_POINTER;
  844. USES_CONVERSION
  845. if ( NULL != pbsTitle ) {
  846. *pbsTitle = NULL;
  847. if (m_pObj->m_Graph.Options.pszGraphTitle != NULL) {
  848. *pbsTitle = SysAllocString(T2W(m_pObj->m_Graph.Options.pszGraphTitle));
  849. if (*pbsTitle == NULL)
  850. hr = E_OUTOFMEMORY;
  851. }
  852. hr = NOERROR;
  853. }
  854. return hr;
  855. }
  856. STDMETHODIMP
  857. CImpISystemMonitor::put_LogFileName (
  858. IN BSTR bstrLogFile
  859. )
  860. /*++
  861. Routine Description:
  862. Sets the log file name
  863. Arguments:
  864. bstrLogFile - File name string
  865. Return Value:
  866. HRESULT
  867. --*/
  868. {
  869. HRESULT hr = S_OK;
  870. LPTSTR pszLogFile = NULL;
  871. LONG lCount;
  872. USES_CONVERSION
  873. // Ensure that the current log file count is 0 or 1
  874. lCount = m_pObj->m_pCtrl->NumLogFiles();
  875. // Get the current data source type
  876. if ( 0 == lCount || 1 == lCount ) {
  877. // Reset the data source type to null data source while completing this operation.
  878. // TodoLogFiles: Possible to keep the previous put_LogFileName semantics,
  879. // where new query is opened (successfully) before closing the previous query?
  880. hr = m_pObj->m_pCtrl->put_DataSourceType ( sysmonNullDataSource );
  881. if ( SUCCEEDED ( hr ) ) {
  882. // TodoLogFiles: What if multiple files exist? Probably return error re: not supported.
  883. if ( 1 == lCount ) {
  884. hr = m_pObj->m_pCtrl->RemoveSingleLogFile ( m_pObj->m_pCtrl->FirstLogFile() );
  885. }
  886. if ( SUCCEEDED ( hr ) ) {
  887. // Check name
  888. if (bstrLogFile != NULL && bstrLogFile[0] != 0) {
  889. // If non-null name
  890. // Convert from BSTR to internal string, then add the item.
  891. pszLogFile = W2T(bstrLogFile);
  892. hr = m_pObj->m_pCtrl->AddSingleLogFile ( pszLogFile );
  893. if ( SUCCEEDED ( hr ) ) {
  894. // put_DataSourceType attempts to set the data source type to sysmonCurrentActivity
  895. // if sysmonLogFiles fails.
  896. hr = m_pObj->m_pCtrl->put_DataSourceType ( sysmonLogFiles );
  897. }
  898. }
  899. }
  900. }
  901. } else {
  902. hr = E_INVALIDARG;
  903. }
  904. return hr;
  905. }
  906. STDMETHODIMP
  907. CImpISystemMonitor::get_LogFileName (
  908. BSTR *pbsLogFile
  909. )
  910. /*++
  911. Routine Description:
  912. Gets the log file name. The caller is responsible for releasing the
  913. string memory.
  914. This is an obsolete method supported only for backward compatibility.
  915. It cannot be used when multiple log files are loaded.
  916. Arguments:
  917. pbsLogFile - pointer to returned name (BSTR)
  918. Return Value:
  919. HResult
  920. --*/
  921. {
  922. HRESULT hr = NOERROR;
  923. LPCTSTR pszFileName = NULL;
  924. LPTSTR pszLogFile = NULL;
  925. ULONG LogFileSize = 0;
  926. CLogFileItem * pLogFile;
  927. LPTSTR pszLogFileCurrent;
  928. USES_CONVERSION
  929. if (NULL != pbsLogFile) {
  930. *pbsLogFile = NULL;
  931. pLogFile = m_pObj->m_pCtrl->FirstLogFile();
  932. while (pLogFile) {
  933. pszFileName = pLogFile->GetPath();
  934. LogFileSize += (lstrlen(pszFileName) + 1);
  935. pLogFile = pLogFile->Next();
  936. }
  937. LogFileSize ++; // for the final NULL character
  938. pszLogFile = (LPTSTR) malloc(LogFileSize * sizeof(TCHAR));
  939. if (pszLogFile) {
  940. pLogFile = m_pObj->m_pCtrl->FirstLogFile();
  941. pszLogFileCurrent = pszLogFile;
  942. while (pLogFile) {
  943. pszFileName = pLogFile->GetPath();
  944. lstrcpy(pszLogFileCurrent, pszFileName);
  945. pszLogFileCurrent += lstrlen(pszFileName);
  946. * pszLogFileCurrent = _T('\0');
  947. pszLogFileCurrent ++;
  948. pLogFile = pLogFile->Next();
  949. }
  950. * pszLogFileCurrent = _T('\0');
  951. * pbsLogFile = SysAllocStringLen(pszLogFile, LogFileSize);
  952. if (NULL == * pbsLogFile) {
  953. hr = E_OUTOFMEMORY;
  954. }
  955. free(pszLogFile);
  956. }
  957. else {
  958. hr = E_OUTOFMEMORY;
  959. }
  960. }
  961. else {
  962. hr = E_POINTER;
  963. }
  964. return hr;
  965. }
  966. STDMETHODIMP
  967. CImpISystemMonitor::put_DataSourceType (
  968. IN eDataSourceTypeConstant eDataSourceType
  969. )
  970. /*++
  971. Routine Description:
  972. Selects data source type (1 = current activity, 2 = log files)
  973. Arguments:
  974. eDataSourceType - Data source type
  975. Return Value:
  976. HRESULT
  977. --*/
  978. {
  979. if ( eDataSourceType != sysmonCurrentActivity
  980. && eDataSourceType != sysmonLogFiles
  981. && sysmonNullDataSource != eDataSourceType
  982. && eDataSourceType != sysmonSqlLog) {
  983. return E_INVALIDARG;
  984. }
  985. return m_pObj->m_pCtrl->put_DataSourceType( eDataSourceType );
  986. }
  987. STDMETHODIMP
  988. CImpISystemMonitor::get_DataSourceType (
  989. OUT eDataSourceTypeConstant *peDataSourceType
  990. )
  991. /*++
  992. Routine Description:
  993. Get data source type (1 = current activity, 2 = log files)
  994. Arguments:
  995. peDataSourceType = pointer to returned value
  996. Return Value:
  997. HRESULT
  998. --*/
  999. {
  1000. HRESULT hr = E_POINTER;
  1001. if ( NULL != peDataSourceType ) {
  1002. hr = m_pObj->m_pCtrl->get_DataSourceType ( *peDataSourceType );
  1003. }
  1004. return hr;
  1005. }
  1006. STDMETHODIMP
  1007. CImpISystemMonitor::get_LogFiles (
  1008. ILogFiles **ppILogFiles
  1009. )
  1010. {
  1011. HRESULT hr = E_POINTER;
  1012. if ( NULL != ppILogFiles ) {
  1013. *ppILogFiles = m_pObj->m_pImpILogFiles;
  1014. if ( NULL != *ppILogFiles ) {
  1015. (*ppILogFiles)->AddRef();
  1016. }
  1017. hr = NOERROR;
  1018. }
  1019. return hr;
  1020. }
  1021. STDMETHODIMP
  1022. CImpISystemMonitor::put_LogViewStart (
  1023. IN DATE dateStart
  1024. )
  1025. {
  1026. LONGLONG llTestStart;
  1027. if ( VariantDateToLLTime(dateStart, &llTestStart ) ) {
  1028. // No error. If start time is past current stop time, reset it to the current stop time.
  1029. if ( llTestStart <= m_pObj->m_pCtrl->m_DataSourceInfo.llStopDisp ){
  1030. if ( llTestStart >= m_pObj->m_pCtrl->m_DataSourceInfo.llBeginTime ) {
  1031. m_pObj->m_pCtrl->m_DataSourceInfo.llStartDisp = llTestStart;
  1032. } else {
  1033. m_pObj->m_pCtrl->m_DataSourceInfo.llStartDisp = m_pObj->m_pCtrl->m_DataSourceInfo.llBeginTime;
  1034. }
  1035. } else {
  1036. m_pObj->m_pCtrl->m_DataSourceInfo.llStartDisp = m_pObj->m_pCtrl->m_DataSourceInfo.llStopDisp;
  1037. }
  1038. m_pObj->m_pCtrl->UpdateGraph(UPDGRPH_LOGVIEW);
  1039. return NOERROR;
  1040. } else {
  1041. return E_FAIL;
  1042. }
  1043. }
  1044. STDMETHODIMP
  1045. CImpISystemMonitor::get_LogViewStart (
  1046. OUT DATE *pdateStart
  1047. )
  1048. {
  1049. HRESULT hr = E_POINTER;
  1050. if ( NULL != pdateStart ) {
  1051. if (LLTimeToVariantDate(m_pObj->m_pCtrl->m_DataSourceInfo.llStartDisp, pdateStart))
  1052. hr = NOERROR;
  1053. else
  1054. hr = E_FAIL;
  1055. }
  1056. return hr;
  1057. }
  1058. STDMETHODIMP
  1059. CImpISystemMonitor::put_LogViewStop (
  1060. IN DATE dateStop
  1061. )
  1062. {
  1063. LONGLONG llTestStop;
  1064. if ( VariantDateToLLTime(dateStop, &llTestStop ) ) {
  1065. // No error. If requested stop time is earlier than current start time, set it to
  1066. // the current start time.
  1067. if ( llTestStop >= m_pObj->m_pCtrl->m_DataSourceInfo.llStartDisp ) {
  1068. if ( llTestStop <= m_pObj->m_pCtrl->m_DataSourceInfo.llEndTime ) {
  1069. m_pObj->m_pCtrl->m_DataSourceInfo.llStopDisp = llTestStop;
  1070. } else {
  1071. m_pObj->m_pCtrl->m_DataSourceInfo.llStopDisp = m_pObj->m_pCtrl->m_DataSourceInfo.llEndTime;
  1072. }
  1073. } else {
  1074. m_pObj->m_pCtrl->m_DataSourceInfo.llStopDisp = m_pObj->m_pCtrl->m_DataSourceInfo.llStartDisp;
  1075. }
  1076. m_pObj->m_pCtrl->UpdateGraph(UPDGRPH_LOGVIEW);
  1077. return NOERROR;
  1078. } else {
  1079. return E_FAIL;
  1080. }
  1081. }
  1082. STDMETHODIMP
  1083. CImpISystemMonitor::get_LogViewStop (
  1084. OUT DATE *pdateStop )
  1085. {
  1086. HRESULT hr = E_POINTER;
  1087. if ( NULL != pdateStop ) {
  1088. if (LLTimeToVariantDate(m_pObj->m_pCtrl->m_DataSourceInfo.llStopDisp, pdateStop))
  1089. hr = NOERROR;
  1090. else
  1091. hr = E_FAIL;
  1092. }
  1093. return hr;
  1094. }
  1095. STDMETHODIMP
  1096. CImpISystemMonitor::put_YAxisLabel (
  1097. IN BSTR bstrLabel
  1098. )
  1099. /*++
  1100. Routine Description:
  1101. Sets the Y axis label string.
  1102. Arguments:
  1103. bstrLabel - Label string
  1104. Return Value:
  1105. HRESULT
  1106. --*/
  1107. {
  1108. LPTSTR pszTemp = NULL;
  1109. LPTSTR pszTitle = NULL;
  1110. USES_CONVERSION
  1111. if ( (bstrLabel == NULL) || (bstrLabel[0] == 0) ) {
  1112. delete m_pObj->m_Graph.Options.pszYaxisTitle;
  1113. m_pObj->m_Graph.Options.pszYaxisTitle = NULL;
  1114. }
  1115. else {
  1116. pszTemp = W2T(bstrLabel);
  1117. pszTitle = new TCHAR [lstrlen(pszTemp) + 1];
  1118. if (pszTitle) {
  1119. lstrcpy(pszTitle, pszTemp);
  1120. delete m_pObj->m_Graph.Options.pszYaxisTitle;
  1121. m_pObj->m_Graph.Options.pszYaxisTitle = pszTitle;
  1122. }
  1123. else {
  1124. return E_OUTOFMEMORY;
  1125. }
  1126. }
  1127. m_pObj->m_pCtrl->UpdateGraph(UPDGRPH_LAYOUT);
  1128. return NOERROR;
  1129. }
  1130. STDMETHODIMP
  1131. CImpISystemMonitor::get_YAxisLabel (
  1132. BSTR *pbsTitle
  1133. )
  1134. /*++
  1135. Routine Description:
  1136. Gets the Y axis title string. The caller is responsible for releasing the
  1137. string memory.
  1138. Arguments:
  1139. pbsTitle - pointer to returned title (BSTR)
  1140. Return Value:
  1141. HRESULT
  1142. --*/
  1143. {
  1144. HRESULT hr = E_POINTER;
  1145. USES_CONVERSION
  1146. if ( NULL != pbsTitle ) {
  1147. *pbsTitle = NULL;
  1148. if (m_pObj->m_Graph.Options.pszYaxisTitle != NULL) {
  1149. *pbsTitle = SysAllocString(T2W(m_pObj->m_Graph.Options.pszYaxisTitle));
  1150. if (*pbsTitle != NULL) {
  1151. hr = NOERROR;
  1152. } else {
  1153. hr = E_OUTOFMEMORY;
  1154. }
  1155. }
  1156. }
  1157. return hr;
  1158. }
  1159. STDMETHODIMP
  1160. CImpISystemMonitor::get_Counters (
  1161. ICounters **ppICounters
  1162. )
  1163. {
  1164. HRESULT hr = E_POINTER;
  1165. if ( NULL != ppICounters ) {
  1166. *ppICounters = m_pObj->m_pImpICounters;
  1167. (*ppICounters)->AddRef();
  1168. hr = NOERROR;
  1169. }
  1170. return hr;
  1171. }
  1172. STDMETHODIMP
  1173. CImpISystemMonitor::put_ReadOnly (
  1174. IN VARIANT_BOOL bState )
  1175. {
  1176. BOOL bStateLocal = FALSE;
  1177. if ( bState )
  1178. bStateLocal = TRUE;
  1179. m_pObj->m_Graph.Options.bReadOnly = bStateLocal;
  1180. m_pObj->m_pCtrl->UpdateGraph(UPDGRPH_VIEW);
  1181. return NOERROR;
  1182. }
  1183. STDMETHODIMP
  1184. CImpISystemMonitor::get_ReadOnly (
  1185. OUT VARIANT_BOOL *pbState )
  1186. {
  1187. HRESULT hr = E_POINTER;
  1188. if ( NULL != pbState ) {
  1189. *pbState = (short)m_pObj->m_Graph.Options.bReadOnly;
  1190. hr = NOERROR;
  1191. }
  1192. return hr;
  1193. }
  1194. STDMETHODIMP
  1195. CImpISystemMonitor::put_ReportValueType (
  1196. IN eReportValueTypeConstant eReportValueType
  1197. )
  1198. /*++
  1199. Routine Description:
  1200. Selects report value type
  1201. 0 = default value (current for live data, average for log file)
  1202. 1 = current value
  1203. 2 = average over the graph display interval
  1204. 3 = minimum for the graph display interval
  1205. 4 = maximum for the graph display interval
  1206. Arguments:
  1207. eReportValueType - Report valuex
  1208. Return Value:
  1209. HRESULT
  1210. --*/
  1211. {
  1212. if (eReportValueType < sysmonDefaultValue || eReportValueType > sysmonMaximum )
  1213. return E_INVALIDARG;
  1214. m_pObj->m_Graph.Options.iReportValueType = eReportValueType;
  1215. // Update the graph for both report and histogram views.
  1216. if (m_pObj->m_Graph.Options.iDisplayType != LINE_GRAPH )
  1217. m_pObj->m_pCtrl->UpdateGraph(UPDGRPH_VIEW);
  1218. return NOERROR;
  1219. }
  1220. STDMETHODIMP
  1221. CImpISystemMonitor::get_ReportValueType (
  1222. OUT eReportValueTypeConstant *peReportValueType
  1223. )
  1224. /*++
  1225. Routine Description:
  1226. Get report value type
  1227. 0 = default value (current for live data, average for log file)
  1228. 1 = current value
  1229. 2 = average over the graph display interval
  1230. 3 = minimum for the graph display interval
  1231. 4 = maximum for the graph display interval
  1232. Arguments:
  1233. peReportValueType = pointer to returned value
  1234. Return Value:
  1235. HRESULT
  1236. --*/
  1237. {
  1238. HRESULT hr = E_POINTER;
  1239. if ( NULL != peReportValueType ) {
  1240. *peReportValueType = (eReportValueTypeConstant)m_pObj->m_Graph.Options.iReportValueType;
  1241. hr = NOERROR;
  1242. }
  1243. return hr;
  1244. }
  1245. STDMETHODIMP
  1246. CImpISystemMonitor::put_MonitorDuplicateInstances(
  1247. IN VARIANT_BOOL bState
  1248. )
  1249. /*++
  1250. Routine Description:
  1251. Allows/disallows monitoring of duplicate counter instances.
  1252. Arguments:
  1253. bState - TRUE = allow, FALSE = disallow)
  1254. Return Value:
  1255. HRESULT
  1256. --*/
  1257. {
  1258. m_pObj->m_Graph.Options.bMonitorDuplicateInstances = bState;
  1259. return NOERROR;
  1260. }
  1261. STDMETHODIMP
  1262. CImpISystemMonitor::get_MonitorDuplicateInstances (
  1263. OUT VARIANT_BOOL *pbState
  1264. )
  1265. /*++
  1266. Routine Description:
  1267. Gets the state of allowing monitoring of duplicate counter instances.
  1268. Arguments:
  1269. pbState - pointer to returned state ( TRUE = allow, FALSE = disallow )
  1270. Return Value:
  1271. HRESULT
  1272. --*/
  1273. {
  1274. HRESULT hr = E_POINTER;
  1275. if ( NULL != pbState ) {
  1276. *pbState = (short)m_pObj->m_Graph.Options.bMonitorDuplicateInstances;
  1277. hr = NOERROR;
  1278. }
  1279. return hr;
  1280. }
  1281. STDMETHODIMP
  1282. CImpISystemMonitor::put_SqlDsnName (
  1283. IN BSTR bsSqlDsnName
  1284. )
  1285. /*++
  1286. Routine Description:
  1287. Sets the SQL logset DSN name.
  1288. Return Value:
  1289. HRESULT
  1290. --*/
  1291. {
  1292. HRESULT hr = NOERROR;
  1293. LPTSTR szTemp = NULL;
  1294. LPTSTR szSqlDsnName = NULL;
  1295. USES_CONVERSION
  1296. if ((bsSqlDsnName == NULL) || (bsSqlDsnName[0] == 0)) {
  1297. if (m_pObj->m_pCtrl->m_DataSourceInfo.szSqlDsnName) {
  1298. delete m_pObj->m_pCtrl->m_DataSourceInfo.szSqlDsnName;
  1299. m_pObj->m_pCtrl->m_DataSourceInfo.szSqlDsnName = NULL;
  1300. }
  1301. }
  1302. else {
  1303. szTemp = W2T(bsSqlDsnName);
  1304. szSqlDsnName = new TCHAR [lstrlen(szTemp) + 1];
  1305. if (szSqlDsnName) {
  1306. lstrcpy(szSqlDsnName, szTemp);
  1307. delete m_pObj->m_pCtrl->m_DataSourceInfo.szSqlDsnName;
  1308. m_pObj->m_pCtrl->m_DataSourceInfo.szSqlDsnName = szSqlDsnName;
  1309. }
  1310. else {
  1311. hr = E_OUTOFMEMORY;
  1312. }
  1313. }
  1314. return hr;
  1315. }
  1316. STDMETHODIMP
  1317. CImpISystemMonitor::get_SqlDsnName (
  1318. BSTR * bsSqlDsnName
  1319. )
  1320. /*++
  1321. Routine Description:
  1322. Gets SQL DSN name string. The caller is responsible for releasing the
  1323. string memory.
  1324. Return Value:
  1325. HRESULT
  1326. --*/
  1327. {
  1328. HRESULT hr = E_POINTER;
  1329. USES_CONVERSION
  1330. if (bsSqlDsnName != NULL) {
  1331. * bsSqlDsnName = NULL;
  1332. if (m_pObj->m_pCtrl->m_DataSourceInfo.szSqlDsnName != NULL) {
  1333. * bsSqlDsnName = SysAllocString(
  1334. T2W(m_pObj->m_pCtrl->m_DataSourceInfo.szSqlDsnName));
  1335. if (* bsSqlDsnName != NULL) {
  1336. hr = NOERROR;
  1337. }
  1338. else {
  1339. hr = E_OUTOFMEMORY;
  1340. }
  1341. }
  1342. }
  1343. return hr;
  1344. }
  1345. STDMETHODIMP
  1346. CImpISystemMonitor::put_SqlLogSetName (
  1347. IN BSTR bsSqlLogSetName
  1348. )
  1349. /*++
  1350. Routine Description:
  1351. Sets the SQL logset DSN name.
  1352. Return Value:
  1353. HRESULT
  1354. --*/
  1355. {
  1356. HRESULT hr = NOERROR;
  1357. LPTSTR szTemp = NULL;
  1358. LPTSTR szSqlLogSetName = NULL;
  1359. USES_CONVERSION
  1360. if ((bsSqlLogSetName == NULL) || (bsSqlLogSetName[0] == 0)) {
  1361. if (m_pObj->m_pCtrl->m_DataSourceInfo.szSqlLogSetName) {
  1362. delete m_pObj->m_pCtrl->m_DataSourceInfo.szSqlLogSetName;
  1363. m_pObj->m_pCtrl->m_DataSourceInfo.szSqlLogSetName = NULL;
  1364. }
  1365. }
  1366. else {
  1367. szTemp = W2T(bsSqlLogSetName);
  1368. szSqlLogSetName = new TCHAR [lstrlen(szTemp) + 1];
  1369. if (szSqlLogSetName) {
  1370. lstrcpy(szSqlLogSetName, szTemp);
  1371. delete m_pObj->m_pCtrl->m_DataSourceInfo.szSqlLogSetName;
  1372. m_pObj->m_pCtrl->m_DataSourceInfo.szSqlLogSetName = szSqlLogSetName;
  1373. }
  1374. else {
  1375. hr = E_OUTOFMEMORY;
  1376. }
  1377. }
  1378. return hr;
  1379. }
  1380. STDMETHODIMP
  1381. CImpISystemMonitor::get_SqlLogSetName (
  1382. BSTR * bsSqlLogSetName
  1383. )
  1384. /*++
  1385. Routine Description:
  1386. Gets SQL DSN name string. The caller is responsible for releasing the
  1387. string memory.
  1388. Return Value:
  1389. HRESULT
  1390. --*/
  1391. {
  1392. HRESULT hr = E_POINTER;
  1393. USES_CONVERSION
  1394. if (bsSqlLogSetName != NULL) {
  1395. * bsSqlLogSetName = NULL;
  1396. if (m_pObj->m_pCtrl->m_DataSourceInfo.szSqlLogSetName != NULL) {
  1397. * bsSqlLogSetName = SysAllocString(
  1398. T2W(m_pObj->m_pCtrl->m_DataSourceInfo.szSqlLogSetName));
  1399. if (* bsSqlLogSetName != NULL) {
  1400. hr = NOERROR;
  1401. }
  1402. else {
  1403. hr = E_OUTOFMEMORY;
  1404. }
  1405. }
  1406. }
  1407. return hr;
  1408. }
  1409. STDMETHODIMP
  1410. CImpISystemMonitor::Counter (
  1411. IN INT iIndex,
  1412. OUT ICounterItem **ppItem
  1413. )
  1414. /*++
  1415. Routine Description:
  1416. Gets the ICounterItem interface for an indexed counter.
  1417. Index is one-based.
  1418. Arguments:
  1419. iIndex - Index of counter (0-based)
  1420. ppItem - pointer to returned interface pointer
  1421. Return Value:
  1422. HRESULT
  1423. --*/
  1424. {
  1425. HRESULT hr = E_POINTER;
  1426. CGraphItem *pGItem;
  1427. INT i;
  1428. if ( NULL != ppItem ) {
  1429. *ppItem = NULL;
  1430. // Check for valid index
  1431. if (iIndex < 0 || iIndex >= m_pObj->m_Graph.CounterTree.NumCounters())
  1432. return E_INVALIDARG;
  1433. // Traverse counter linked list to indexed item
  1434. pGItem = m_pObj->m_Graph.CounterTree.FirstCounter();
  1435. i = 0;
  1436. while (i++ < iIndex && pGItem != NULL) {
  1437. pGItem = pGItem->Next();
  1438. }
  1439. if (pGItem == NULL)
  1440. return E_FAIL;
  1441. pGItem->AddRef();
  1442. *ppItem = pGItem;
  1443. hr = NOERROR;
  1444. }
  1445. return hr;
  1446. }
  1447. STDMETHODIMP
  1448. CImpISystemMonitor::AddCounter (
  1449. IN BSTR bstrPath,
  1450. ICounterItem **ppItem
  1451. )
  1452. /*++
  1453. Routine Description:
  1454. Add counter specified by pathname to the control.
  1455. This method supports wildcard paths.
  1456. Arguments:
  1457. bstrPath - Pathname string
  1458. ppItem - pointer to returned interface pointer
  1459. Return Value:
  1460. HRESULT
  1461. --*/
  1462. {
  1463. HRESULT hr = E_POINTER;
  1464. USES_CONVERSION
  1465. if ( NULL != ppItem ) {
  1466. // Delegate to control object
  1467. hr = m_pObj->m_pCtrl->AddCounter(W2T(bstrPath), (CGraphItem**)ppItem);
  1468. }
  1469. return hr;
  1470. }
  1471. STDMETHODIMP
  1472. CImpISystemMonitor::DeleteCounter (
  1473. IN ICounterItem *pItem
  1474. )
  1475. /*++
  1476. Routine Description:
  1477. Deletes a counter from the control.
  1478. Arguments:
  1479. pItem - Pointer to counter's ICounterItem interface
  1480. Return Value:
  1481. HRESULT
  1482. --*/
  1483. {
  1484. HRESULT hr = E_POINTER;
  1485. USES_CONVERSION
  1486. if ( NULL != pItem ) {
  1487. // Delegate to control object
  1488. hr = m_pObj->m_pCtrl->DeleteCounter((PCGraphItem)pItem, TRUE);
  1489. }
  1490. return hr;
  1491. }
  1492. STDMETHODIMP
  1493. CImpISystemMonitor::UpdateGraph (
  1494. VOID
  1495. )
  1496. /*++
  1497. Routine Description:
  1498. Apply pending visual changes to control. This routine must be called after
  1499. changing a counter's attributes.
  1500. Arguments:
  1501. None.
  1502. Return Value:
  1503. HRESULT
  1504. --*/
  1505. {
  1506. // Delegate to control object
  1507. m_pObj->m_pCtrl->UpdateGraph(0);
  1508. return NOERROR;
  1509. }
  1510. STDMETHODIMP
  1511. CImpISystemMonitor::CollectSample(
  1512. VOID
  1513. )
  1514. /*++
  1515. Routine Description:
  1516. Take a sample of all the counters assigned to the control.
  1517. Arguments:
  1518. None.
  1519. Return Value:
  1520. HRESULT.
  1521. --*/
  1522. {
  1523. // Request control to do a manual counter update
  1524. if (m_pObj->m_pCtrl->UpdateCounterValues(TRUE) == 0)
  1525. return NOERROR;
  1526. else
  1527. return E_FAIL;
  1528. }
  1529. STDMETHODIMP
  1530. CImpISystemMonitor::BrowseCounters(
  1531. VOID
  1532. )
  1533. /*++
  1534. Routine Description:
  1535. Display the browse counter dialog to allow counters
  1536. to be added.
  1537. Arguments:
  1538. None.
  1539. Return Value:
  1540. HRESULT.
  1541. --*/
  1542. {
  1543. // Delegate to control
  1544. return m_pObj->m_pCtrl->AddCounters();
  1545. }
  1546. STDMETHODIMP
  1547. CImpISystemMonitor::DisplayProperties(
  1548. VOID
  1549. )
  1550. /*++
  1551. Routine Description:
  1552. Display the graph control property pages
  1553. Arguments:
  1554. None.
  1555. Return Value:
  1556. HRESULT.
  1557. --*/
  1558. {
  1559. // Delegate to control
  1560. return m_pObj->m_pCtrl->DisplayProperties();
  1561. }
  1562. STDMETHODIMP
  1563. CImpISystemMonitor::Paste ()
  1564. /*++
  1565. Routine Description:
  1566. Pastes a list of counter paths from the clipboard to the control
  1567. Arguments:
  1568. NULL
  1569. Return Value:
  1570. HRESULT
  1571. --*/
  1572. {
  1573. // Delegate to control object
  1574. return m_pObj->m_pCtrl->Paste();
  1575. }
  1576. STDMETHODIMP
  1577. CImpISystemMonitor::Copy ()
  1578. /*++
  1579. Routine Description:
  1580. Copies a list of counter paths from the control to the clipboard
  1581. Arguments:
  1582. NULL
  1583. Return Value:
  1584. HRESULT
  1585. --*/
  1586. {
  1587. // Delegate to control object
  1588. return m_pObj->m_pCtrl->Copy();
  1589. }
  1590. STDMETHODIMP
  1591. CImpISystemMonitor::Reset ()
  1592. /*++
  1593. Routine Description:
  1594. deletes the current set of counters
  1595. Arguments:
  1596. NULL
  1597. Return Value:
  1598. HRESULT
  1599. --*/
  1600. {
  1601. // Delegate to control object
  1602. return m_pObj->m_pCtrl->Reset();
  1603. }
  1604. void
  1605. CImpISystemMonitor::SetLogFileRange (
  1606. LONGLONG llBegin,
  1607. LONGLONG llEnd
  1608. )
  1609. /*++
  1610. Routine Description:
  1611. Set the log file time range. This routine provides the Source
  1612. property page a way to give range to the control, so that the control
  1613. doesn't have to repeat the length PDH call to get it.
  1614. Arguments:
  1615. llBegin Begin time of the log (FILETIME format)
  1616. llEnd End time of log (FILETIME format)
  1617. Return Value:
  1618. HRESULT.
  1619. --*/
  1620. {
  1621. m_pObj->m_pCtrl->m_DataSourceInfo.llBeginTime = llBegin;
  1622. m_pObj->m_pCtrl->m_DataSourceInfo.llEndTime = llEnd;
  1623. }
  1624. void
  1625. CImpISystemMonitor::GetLogFileRange (
  1626. LONGLONG *pllBegin,
  1627. LONGLONG *pllEnd
  1628. )
  1629. /*++
  1630. Routine Description:
  1631. Get the log file time range. This routine provides the Source
  1632. property page a way to get the range from the control, so it doesn't
  1633. have to make the length PDH call to get it.
  1634. Arguments:
  1635. pllBegin ptr to returned begin time of the log (FILETIME format)
  1636. pllEnd ptr to returned end time of log (FILETIME format)
  1637. Return Value:
  1638. HRESULT.
  1639. --*/
  1640. {
  1641. if ( NULL != pllBegin && NULL != pllEnd ) {
  1642. *pllBegin = m_pObj->m_pCtrl->m_DataSourceInfo.llBeginTime;
  1643. *pllEnd = m_pObj->m_pCtrl->m_DataSourceInfo.llEndTime;
  1644. }
  1645. }
  1646. /*
  1647. * The following methods, GetVisuals and SetVisuals, provide a means for the
  1648. * counter property page to save the user's color settings between invocations.
  1649. */
  1650. void
  1651. CImpISystemMonitor::GetVisuals (
  1652. OUT OLE_COLOR *pColor,
  1653. OUT INT *piColorIndex,
  1654. OUT INT *piWidthIndex,
  1655. OUT INT *piStyleIndex
  1656. )
  1657. {
  1658. if ( NULL != pColor
  1659. && NULL != piColorIndex
  1660. && NULL != piWidthIndex
  1661. && NULL != piStyleIndex ) {
  1662. *pColor = m_pObj->m_pCtrl->m_clrCounter;
  1663. *piColorIndex = m_pObj->m_pCtrl->m_iColorIndex;
  1664. *piWidthIndex = m_pObj->m_pCtrl->m_iWidthIndex;
  1665. *piStyleIndex = m_pObj->m_pCtrl->m_iStyleIndex;
  1666. }
  1667. }
  1668. void
  1669. CImpISystemMonitor::SetVisuals (
  1670. IN OLE_COLOR Color,
  1671. IN INT iColorIndex,
  1672. IN INT iWidthIndex,
  1673. IN INT iStyleIndex
  1674. )
  1675. {
  1676. OleTranslateColor( Color, NULL, &m_pObj->m_pCtrl->m_clrCounter );
  1677. m_pObj->m_pCtrl->m_iColorIndex = iColorIndex;
  1678. m_pObj->m_pCtrl->m_iWidthIndex = iWidthIndex;
  1679. m_pObj->m_pCtrl->m_iStyleIndex = iStyleIndex;
  1680. }
  1681. HRESULT
  1682. CImpISystemMonitor::SetLogViewTempRange (
  1683. LONGLONG llStart,
  1684. LONGLONG llStop
  1685. )
  1686. /*++
  1687. Routine Description:
  1688. Set the log view temporary time range. This routine provides the Source
  1689. property page a way to give range to the control, so that the control
  1690. can draw temporary timeline guides on the line graph.
  1691. Arguments:
  1692. llStart Temporary log view start time (FILETIME format)
  1693. llEnd Temporary log view end time (FILETIME format)
  1694. Return Value:
  1695. HRESULT.
  1696. --*/
  1697. {
  1698. HRESULT hr;
  1699. DATE dateStart;
  1700. DATE dateStop;
  1701. LONGLONG llConvertedStart = MIN_TIME_VALUE;
  1702. LONGLONG llConvertedStop = MAX_TIME_VALUE;
  1703. BOOL bContinue = TRUE;
  1704. // Convert times to and from Variant date to strip off milliseconds.
  1705. // This will make them match the start and stop times processed by put_LogView*
  1706. // Special case MAX_TIME_VALUE, because that is the signal to not draw the stop
  1707. // guide line.
  1708. // Convert start time
  1709. if ( LLTimeToVariantDate ( llStart, &dateStart ) ) {
  1710. bContinue = VariantDateToLLTime (dateStart, &llConvertedStart );
  1711. }
  1712. // Convert stop time if not MAX_TIME_VALUE
  1713. if ( bContinue ) {
  1714. if ( MAX_TIME_VALUE != llStop ) {
  1715. if ( LLTimeToVariantDate ( llStop, &dateStop ) ) {
  1716. bContinue = VariantDateToLLTime ( dateStop, &llConvertedStop );
  1717. }
  1718. } else {
  1719. llConvertedStop = MAX_TIME_VALUE;
  1720. }
  1721. }
  1722. if ( bContinue ) {
  1723. m_pObj->m_pCtrl->SetLogViewTempTimeRange ( llConvertedStart, llConvertedStop );
  1724. hr = NOERROR;
  1725. } else {
  1726. hr = E_FAIL;
  1727. }
  1728. return hr;
  1729. }
  1730. STDMETHODIMP
  1731. CImpISystemMonitor::LogFile (
  1732. IN INT iIndex,
  1733. OUT ILogFileItem **ppItem
  1734. )
  1735. /*++
  1736. Routine Description:
  1737. Gets the ILogFileItem interface for an indexed log file.
  1738. Index is 0-based.
  1739. Arguments:
  1740. iIndex - Index of counter (0-based)
  1741. ppItem - pointer to returned interface pointer
  1742. Return Value:
  1743. HRESULT
  1744. --*/
  1745. {
  1746. HRESULT hr = E_POINTER;
  1747. CLogFileItem *pItem;
  1748. INT i;
  1749. if ( NULL != ppItem ) {
  1750. *ppItem = NULL;
  1751. // Check for valid index
  1752. if (iIndex >= 0 && iIndex < m_pObj->m_pCtrl->NumLogFiles()) {
  1753. // Traverse counter linked list to indexed item
  1754. pItem = m_pObj->m_pCtrl->FirstLogFile();
  1755. i = 0;
  1756. while (i++ < iIndex && pItem != NULL) {
  1757. pItem = pItem->Next();
  1758. }
  1759. if (pItem != NULL) {
  1760. pItem->AddRef();
  1761. *ppItem = pItem;
  1762. hr = NOERROR;
  1763. } else {
  1764. hr = E_FAIL;
  1765. }
  1766. } else {
  1767. hr = E_INVALIDARG;
  1768. }
  1769. }
  1770. return hr;
  1771. }
  1772. STDMETHODIMP
  1773. CImpISystemMonitor::AddLogFile (
  1774. IN BSTR bstrPath,
  1775. ILogFileItem **ppItem
  1776. )
  1777. /*++
  1778. Routine Description:
  1779. Add log file specified by pathname to the control.
  1780. This method does not support wildcard paths.
  1781. Arguments:
  1782. bstrPath - Pathname string
  1783. ppItem - pointer to returned interface pointer
  1784. Return Value:
  1785. HRESULT
  1786. --*/
  1787. {
  1788. HRESULT hr = E_POINTER;
  1789. USES_CONVERSION
  1790. if ( NULL != ppItem ) {
  1791. // TodoLogFiles: AddSingleLogFile should check for duplicate file names.
  1792. // If duplicate, return special status, ala AddCounter
  1793. // Delegate to control object
  1794. hr = m_pObj->m_pCtrl->AddSingleLogFile(W2T(bstrPath), (CLogFileItem**)ppItem);
  1795. }
  1796. return hr;
  1797. }
  1798. STDMETHODIMP
  1799. CImpISystemMonitor::DeleteLogFile (
  1800. IN ILogFileItem *pItem
  1801. )
  1802. /*++
  1803. Routine Description:
  1804. Deletes a log file from the control.
  1805. Arguments:
  1806. pItem - Pointer to log file's ILogFileItem interface
  1807. Return Value:
  1808. HRESULT
  1809. --*/
  1810. {
  1811. HRESULT hr = E_POINTER;
  1812. USES_CONVERSION
  1813. if ( NULL != pItem ) {
  1814. // Delegate to control object
  1815. hr = m_pObj->m_pCtrl->RemoveSingleLogFile( (PCLogFileItem)pItem );
  1816. }
  1817. return hr;
  1818. }
  1819. //IOleControl interface implementation
  1820. /*
  1821. * CImpIOleControl::CImpIOleControl
  1822. * CImpIOleControl::~CImpIOleControl
  1823. *
  1824. * Parameters (Constructor):
  1825. * pObj PCPolyline of the object we're in.
  1826. * pUnkOuter LPUNKNOWN to which we delegate.
  1827. */
  1828. CImpIOleControl::CImpIOleControl (
  1829. IN PCPolyline pObj,
  1830. IN LPUNKNOWN pUnkOuter
  1831. )
  1832. {
  1833. m_cRef = 0;
  1834. m_pObj = pObj;
  1835. m_pUnkOuter = pUnkOuter;
  1836. }
  1837. CImpIOleControl::~CImpIOleControl (
  1838. VOID
  1839. )
  1840. {
  1841. return;
  1842. }
  1843. /*
  1844. * CImpIOleControl::QueryInterface
  1845. * CImpIOleControl::AddRef
  1846. * CImpIOleControl::Release
  1847. */
  1848. STDMETHODIMP
  1849. CImpIOleControl::QueryInterface(
  1850. IN REFIID riid,
  1851. OUT LPVOID *ppv
  1852. )
  1853. {
  1854. return m_pUnkOuter->QueryInterface(riid, ppv);
  1855. }
  1856. STDMETHODIMP_( ULONG )
  1857. CImpIOleControl::AddRef(
  1858. VOID
  1859. )
  1860. {
  1861. ++m_cRef;
  1862. return m_pUnkOuter->AddRef();
  1863. }
  1864. STDMETHODIMP_(ULONG) CImpIOleControl::Release(void)
  1865. {
  1866. --m_cRef;
  1867. return m_pUnkOuter->Release();
  1868. }
  1869. /*
  1870. * CImpIOleControl::GetControlInfo
  1871. *
  1872. * Purpose:
  1873. * Fills a CONTROLINFO structure containing information about
  1874. * the controls mnemonics and other behavioral aspects.
  1875. *
  1876. * Parameters:
  1877. * pCI LPCONTROLINFO to the structure to fill
  1878. */
  1879. STDMETHODIMP
  1880. CImpIOleControl::GetControlInfo ( LPCONTROLINFO pCI )
  1881. {
  1882. if (NULL==pCI)
  1883. return E_POINTER;
  1884. *pCI=m_pObj->m_ctrlInfo;
  1885. return E_NOTIMPL;
  1886. }
  1887. /*
  1888. * CImpIOleControl::OnMnemonic
  1889. *
  1890. * Purpose:
  1891. * Notifies the control that a mnemonic was activated.
  1892. *
  1893. * Parameters:
  1894. * pMsg LPMSG containing the message that matches one of
  1895. * the control's mnemonics. The control uses this
  1896. * to distinguish which mnemonic was pressed.
  1897. */
  1898. STDMETHODIMP CImpIOleControl::OnMnemonic ( LPMSG /* pMsg */ )
  1899. {
  1900. //No mnemonics
  1901. return NOERROR;
  1902. }
  1903. /*
  1904. * CImpIOleControl::OnAmbientPropertyChange
  1905. *
  1906. * Purpose:
  1907. * Notifies the control that one or more of the container's ambient
  1908. * properties changed.
  1909. *
  1910. * Parameters:
  1911. * dispID DISPID identifying the property, which can
  1912. * be DISPID_UNKNOWN indicating that more than
  1913. * one changed.
  1914. */
  1915. STDMETHODIMP
  1916. CImpIOleControl::OnAmbientPropertyChange(DISPID dispID)
  1917. {
  1918. /*
  1919. */
  1920. DWORD dwInitWhich;
  1921. switch (dispID) {
  1922. case DISPID_UNKNOWN:
  1923. {
  1924. dwInitWhich = INITAMBIENT_SHOWHATCHING | INITAMBIENT_UIDEAD
  1925. | INITAMBIENT_BACKCOLOR | INITAMBIENT_FORECOLOR
  1926. | INITAMBIENT_APPEARANCE | INITAMBIENT_USERMODE
  1927. | INITAMBIENT_FONT;
  1928. // Update system colors here until MMC passes on WM_SYSCOLORCHANGE
  1929. m_pObj->m_pCtrl->UpdateNonAmbientSysColors();
  1930. break;
  1931. }
  1932. case DISPID_AMBIENT_SHOWHATCHING:
  1933. dwInitWhich = INITAMBIENT_SHOWHATCHING;
  1934. break;
  1935. case DISPID_AMBIENT_UIDEAD:
  1936. dwInitWhich = INITAMBIENT_UIDEAD;
  1937. break;
  1938. case DISPID_AMBIENT_APPEARANCE:
  1939. dwInitWhich = INITAMBIENT_APPEARANCE;
  1940. break;
  1941. case DISPID_AMBIENT_BACKCOLOR:
  1942. dwInitWhich = INITAMBIENT_BACKCOLOR;
  1943. break;
  1944. case DISPID_AMBIENT_FORECOLOR:
  1945. dwInitWhich = INITAMBIENT_FORECOLOR;
  1946. break;
  1947. case DISPID_AMBIENT_FONT:
  1948. dwInitWhich = INITAMBIENT_FONT;
  1949. break;
  1950. case DISPID_AMBIENT_USERMODE:
  1951. dwInitWhich = INITAMBIENT_USERMODE;
  1952. break;
  1953. default:
  1954. return NOERROR;
  1955. }
  1956. m_pObj->AmbientsInitialize(dwInitWhich);
  1957. return NOERROR;
  1958. }
  1959. /*
  1960. * CImpIOleControl::FreezeEvents
  1961. *
  1962. * Purpose:
  1963. * Instructs the control to stop firing events or to continue
  1964. * firing them.
  1965. *
  1966. * Parameters:
  1967. * fFreeze BOOL indicating to freeze (TRUE) or thaw (FALSE)
  1968. * events from this control.
  1969. */
  1970. STDMETHODIMP
  1971. CImpIOleControl::FreezeEvents(BOOL fFreeze)
  1972. {
  1973. m_pObj->m_fFreezeEvents = fFreeze;
  1974. return NOERROR;
  1975. }
  1976. // Private methods
  1977. STDMETHODIMP
  1978. CImpISystemMonitor::GetSelectedCounter (
  1979. ICounterItem** ppItem
  1980. )
  1981. /*++
  1982. Routine Description:
  1983. Gets the ICounterItem interface for the selected counter.
  1984. Arguments:
  1985. ppItem - pointer to returned interface pointer
  1986. Return Value:
  1987. HResult
  1988. --*/
  1989. {
  1990. HRESULT hr = E_POINTER;
  1991. if ( NULL != ppItem ) {
  1992. *ppItem = (m_pObj->m_pCtrl->m_pSelectedItem);
  1993. if ( NULL != *ppItem ) {
  1994. m_pObj->m_pCtrl->m_pSelectedItem->AddRef();
  1995. }
  1996. hr = NOERROR;
  1997. }
  1998. return hr;
  1999. }
  2000. HLOG
  2001. CImpISystemMonitor::GetDataSourceHandle ( void )
  2002. {
  2003. return m_pObj->m_pCtrl->GetDataSourceHandle( );
  2004. }
  2005. // *** TodoMultiLogHandle: Temporary method. Remove when trace file post-processing supports multiple
  2006. // open files.
  2007. HQUERY
  2008. CImpISystemMonitor::GetQueryHandle ( void )
  2009. {
  2010. return m_pObj->m_pCtrl->TempGetQueryHandle( );
  2011. }