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.

642 lines
17 KiB

  1. // REvents.cpp : All result-pane Notify events. These functions are all
  2. // part of the CSystemInfo class.
  3. //
  4. // Copyright (c) 1998-1999 Microsoft Corporation
  5. #include "StdAfx.h"
  6. // This hack is required because we may be building in an environment
  7. // which doesn't have a late enough version of rpcndr.h
  8. #if __RPCNDR_H_VERSION__ < 440
  9. #define __RPCNDR_H_VERSION__ 440
  10. #define MIDL_INTERFACE(x) interface
  11. #endif
  12. #ifndef __mmc_h__
  13. #include <mmc.h> // ..\..\..\public\sdk\inc
  14. #endif
  15. #include <htmlhelp.h> // ..\..\..\public\sdk\inc
  16. #include "DataObj.h"
  17. #include "SysInfo.h"
  18. #include "ViewObj.h"
  19. // This is not necessary; these are enumerated in the scope pane.
  20. #if 0
  21. /*
  22. * EnumerateCategories - Enumerate all sub-categories of pDataObject
  23. * in the result pane.
  24. *
  25. * History: a-jsari 10/2/97 Initial version
  26. */
  27. HRESULT CSystemInfo::EnumerateCategories(CFolder *pfolSelection)
  28. {
  29. HRESULT hr = S_OK;
  30. RESULTDATAITEM rdiItem;
  31. rdiItem.mask = RDI_STR | RDI_PARAM | RDI_IMAGE;
  32. rdiItem.str = MMC_CALLBACK;
  33. rdiItem.nCol = 0;
  34. rdiItem.nImage = 0;
  35. CFolder *pfolIterator = pfolSelection->GetChildNode();
  36. LPRESULTDATA pResultPane = pResult();
  37. for (rdiItem.nIndex = 0; pfolIterator; ++rdiItem.nIndex,
  38. pfolIterator = pfolIterator->GetNextSibling()) {
  39. // This would leak memory if we used it.
  40. CResultViewObject *proCategory = new CCategoryObject(pfolIterator,
  41. rdiItem.nIndex);
  42. rdiItem.lParam = reinterpret_cast<long>(proCategory);
  43. hr = pResultPane->InsertItem(&rdiItem);
  44. if (FAILED(hr)) break;
  45. }
  46. return hr;
  47. }
  48. #endif
  49. /*
  50. * ClearResultsPane - Clear out all saved state about the results pane,
  51. * in preparation for rebuilding the information.
  52. *
  53. * History: a-jsari 10/7/97 Initial version
  54. */
  55. HRESULT CSystemInfo::ClearResultsPane()
  56. {
  57. // Delete all items.
  58. HRESULT hres = pResult()->DeleteAllRsltItems();
  59. // Clear our list of ViewObjects.
  60. m_lstView.Clear();
  61. return hres;
  62. }
  63. /*
  64. * EnumerateValues - Enumerate all result pane rows, given the CFolder object
  65. * to be displayed.
  66. *
  67. * We do this by getting the number of rows the folder contains and creating a
  68. * single CDatumObject for each row in the folder, attaching that object
  69. * as the lParam data for the RESULTDATAITEM inserted.
  70. *
  71. * History: a-jsari 10/2/97 Initial version
  72. */
  73. HRESULT CSystemInfo::EnumerateValues(CFolder *pfolSelection)
  74. {
  75. HRESULT hr = S_OK;
  76. RESULTDATAITEM rdiItem;
  77. // Set the information common to all of our inserted items
  78. // (Modified below for selected items and by specific item data.)
  79. rdiItem.mask = RDI_STR | RDI_PARAM | RDI_IMAGE;
  80. rdiItem.str = MMC_CALLBACK;
  81. rdiItem.nCol = 0;
  82. rdiItem.nImage = 1;
  83. ASSERT(pfolSelection->GetType() != CDataSource::OCX);
  84. int cRows = dynamic_cast<CListViewFolder *>(pfolSelection)->GetRows();
  85. int nSelectionRow = pfolSelection->GetSelectedItem();
  86. LPRESULTDATA pResultPane = pResult();
  87. if (cRows > 0) {
  88. pResultPane->ModifyViewStyle((MMC_RESULT_VIEW_STYLE ) 0x0008 /* = MMC_ENSUREFOCUSVISIBLE */, (MMC_RESULT_VIEW_STYLE ) 0);
  89. for (rdiItem.nIndex = 0 ; rdiItem.nIndex < cRows ; ++rdiItem.nIndex) {
  90. // Create our new CDatumObject so we have strings for GetDisplayInfo.
  91. CViewObject *proValue = new CDatumObject(pfolSelection,
  92. rdiItem.nIndex);
  93. // Attach it in our data.
  94. rdiItem.lParam = reinterpret_cast<LPARAM>(proValue);
  95. // If we are the item selected by a prior find operation, set ourselves
  96. // as focused and selected, otherwise just add as usual.
  97. if (rdiItem.nIndex == nSelectionRow) {
  98. rdiItem.mask |= RDI_STATE;
  99. rdiItem.nState = LVIS_FOCUSED | LVIS_SELECTED;
  100. hr = pResultPane->InsertItem(&rdiItem);
  101. rdiItem.mask &= ~RDI_STATE;
  102. } else
  103. hr = pResultPane->InsertItem(&rdiItem);
  104. if (FAILED(hr)) break;
  105. // Insert our new'd pointer into the list so we may delete them when we
  106. // clear out our result pane data.
  107. m_lstView.Add(proValue);
  108. }
  109. // Set ourselves to the view mode which gives us column data.
  110. pResultPane->SetViewMode(LVS_REPORT);
  111. pResultPane->ModifyViewStyle((MMC_RESULT_VIEW_STYLE ) 0, (MMC_RESULT_VIEW_STYLE ) 0x0008 /* = MMC_ENSUREFOCUSVISIBLE */);
  112. } else {
  113. // No rows means only automatic [folder] result data items, so use
  114. // a list view.
  115. pResultPane->SetViewMode(LVS_LIST);
  116. }
  117. return hr;
  118. }
  119. /*
  120. * HandleStandardVerbs - Set all of the standard verb states, based on
  121. * the context of lpDataObject and the activity state.
  122. *
  123. * History: a-jsari 9/22/97 Initial version
  124. */
  125. HRESULT CSystemInfo::HandleStandardVerbs(BOOL fScope, LPDATAOBJECT lpDataObject)
  126. {
  127. // CHECK: Candidate for optimization?
  128. SetInitialVerbState(fScope);
  129. CDataObject * pDataObject = GetInternalFromDataObject(lpDataObject);
  130. if (pDataObject)
  131. {
  132. LPCONSOLEVERB pVerbSetting = pConsoleVerb();
  133. if (pVerbSetting)
  134. {
  135. BOOL fIsPrimarySnapin = TRUE;
  136. if (pComponentData())
  137. fIsPrimarySnapin = dynamic_cast<CSystemInfoScope *>(pComponentData())->IsPrimaryImpl();
  138. CDataSource * pSource = pDataObject->pSource();
  139. if (fIsPrimarySnapin && pSource && pSource->GetType() == CDataSource::GATHERER)
  140. pVerbSetting->SetVerbState(MMC_VERB_PROPERTIES, ENABLED, TRUE);
  141. else
  142. pVerbSetting->SetVerbState(MMC_VERB_PROPERTIES, ENABLED, FALSE);
  143. }
  144. }
  145. return S_OK;
  146. }
  147. /*
  148. * SetInitialVerbState - Sets the default state for all of the MMC standard
  149. * verbs.
  150. *
  151. * History: a-jsari 9/22/97 Initial version
  152. */
  153. void CSystemInfo::SetInitialVerbState(BOOL fScope)
  154. {
  155. HRESULT hr;
  156. LPCONSOLEVERB pVerbSetting = pConsoleVerb();
  157. ASSERT(pVerbSetting != NULL);
  158. #if 1
  159. hr = pVerbSetting->SetVerbState(MMC_VERB_PRINT, HIDDEN, FALSE);
  160. ASSERT(hr == S_OK);
  161. hr = pVerbSetting->SetVerbState(MMC_VERB_PRINT, ENABLED, TRUE);
  162. ASSERT(hr == S_OK);
  163. #endif
  164. // hr = pVerbSetting->SetVerbState(MMC_VERB_PROPERTIES, HIDDEN, !fScope);
  165. // ASSERT(hr == S_OK);
  166. // hr = pVerbSetting->SetVerbState(MMC_VERB_PROPERTIES, ENABLED, fScope);
  167. // ASSERT(hr == S_OK);
  168. hr = pVerbSetting->SetVerbState(MMC_VERB_PROPERTIES, HIDDEN, FALSE);
  169. ASSERT(hr == S_OK);
  170. hr = pVerbSetting->SetVerbState(MMC_VERB_PROPERTIES, ENABLED, TRUE);
  171. ASSERT(hr == S_OK);
  172. // Enable Open verb for result pane folder nodes only.
  173. hr = pVerbSetting->SetVerbState(MMC_VERB_OPEN, HIDDEN, TRUE);
  174. ASSERT(hr == S_OK);
  175. hr = pVerbSetting->SetVerbState(MMC_VERB_OPEN, ENABLED, FALSE);
  176. ASSERT(hr == S_OK);
  177. BOOL fRefreshAvailable = FALSE;
  178. if (((CSystemInfoScope *)pComponentData())->pSource() != NULL
  179. && ((CSystemInfoScope *)pComponentData())->pSource()->GetType() == CDataSource::GATHERER)
  180. fRefreshAvailable = TRUE;
  181. hr = pVerbSetting->SetVerbState(MMC_VERB_REFRESH, HIDDEN, !fRefreshAvailable);
  182. ASSERT(hr == S_OK);
  183. hr = pVerbSetting->SetVerbState(MMC_VERB_REFRESH, ENABLED, fRefreshAvailable);
  184. ASSERT(hr == S_OK);
  185. hr = pVerbSetting->SetVerbState(MMC_VERB_COPY, HIDDEN, TRUE);
  186. ASSERT(hr == S_OK);
  187. hr = pVerbSetting->SetVerbState(MMC_VERB_COPY, ENABLED, FALSE);
  188. ASSERT(hr == S_OK);
  189. hr = pVerbSetting->SetVerbState(MMC_VERB_PASTE, HIDDEN, TRUE);
  190. ASSERT(hr == S_OK);
  191. hr = pVerbSetting->SetVerbState(MMC_VERB_PASTE, ENABLED, FALSE);
  192. ASSERT(hr == S_OK);
  193. hr = pVerbSetting->SetVerbState(MMC_VERB_DELETE, HIDDEN, TRUE);
  194. ASSERT(hr == S_OK);
  195. hr = pVerbSetting->SetVerbState(MMC_VERB_DELETE, ENABLED, FALSE);
  196. ASSERT(hr == S_OK);
  197. hr = pVerbSetting->SetVerbState(MMC_VERB_RENAME, ENABLED, FALSE);
  198. ASSERT(hr == S_OK);
  199. }
  200. /*
  201. * SetResultHeaderColumns - Sets the header columns used to display
  202. * standard result pane data.
  203. *
  204. * History: a-jsari 10/2/97 Initial version.
  205. */
  206. HRESULT CSystemInfo::SetResultHeaderColumns(CFolder *pCategory)
  207. {
  208. LPHEADERCTRL pResultHeader;
  209. HRESULT hr;
  210. CListViewFolder *plvfCategory;
  211. AFX_MANAGE_STATE(::AfxGetStaticModuleState());
  212. pResultHeader = pHeaderCtrl();
  213. ASSERT(pResultHeader != NULL);
  214. int cColumns;
  215. ASSERT(pCategory != NULL);
  216. ASSERT(pCategory->GetType() != CDataSource::OCX);
  217. plvfCategory = dynamic_cast<CListViewFolder *>(pCategory);
  218. cColumns = plvfCategory->GetColumns();
  219. do {
  220. hr = pResultHeader->DeleteColumn(0);
  221. } while (hr == S_OK);
  222. for (int i = 0; i < cColumns ; ++i) {
  223. CString szColumnHeading;
  224. DWORD nColumnWidth;
  225. VERIFY(plvfCategory->GetColumnTextAndWidth(i, szColumnHeading, (unsigned &)nColumnWidth));
  226. hr = pResultHeader->InsertColumn(i, (LPCWSTR)szColumnHeading,
  227. LVCFMT_LEFT, nColumnWidth);
  228. if (FAILED(hr)) break;
  229. }
  230. return hr;
  231. }
  232. /*
  233. * OnActivate - Activate event handler
  234. *
  235. * History: a-jsari 10/3/97 Stub version
  236. */
  237. HRESULT CSystemInfo::OnActivate(LPDATAOBJECT, LPARAM)
  238. {
  239. return S_OK;
  240. }
  241. /*
  242. * OnAddImages - Add the folder and leaf item images for the result pane.
  243. *
  244. * History: a-jsari 9/24/97 Stub version
  245. */
  246. HRESULT CSystemInfo::OnAddImages(LPDATAOBJECT, LPIMAGELIST pImageList, HSCOPEITEM)
  247. {
  248. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  249. ::CBitmap bmLarge;
  250. bmLarge.LoadBitmap(IDB_LARGE);
  251. ::CBitmap bmSmall;
  252. bmSmall.LoadBitmap(IDB_SMALLBMP);
  253. HRESULT hr = pImageList->ImageListSetStrip(reinterpret_cast<LONG_PTR *>((HBITMAP)bmSmall),
  254. reinterpret_cast<LONG_PTR *>((HBITMAP)bmLarge), 0, RGB(255,0,255));
  255. ASSERT(hr == S_OK);
  256. return hr;
  257. }
  258. /*
  259. * OnButtonClick - Handle a toolbar button click.
  260. *
  261. * History: a-jsari 9/24/97 Stub version
  262. */
  263. HRESULT CSystemInfo::OnButtonClick(LPDATAOBJECT pDataObject, LPARAM idButton)
  264. {
  265. switch (idButton) {
  266. case IDM_TBB_FIND:
  267. pExtendContextMenu()->Command(CSystemInfoScope::IDM_FIND, pDataObject);
  268. break;
  269. case IDM_TBB_OPEN:
  270. pExtendContextMenu()->Command(CSystemInfoScope::IDM_TASK_OPENFILE, pDataObject);
  271. break;
  272. case IDM_TBB_SAVE:
  273. pExtendContextMenu()->Command(CSystemInfoScope::IDM_SAVEFILE, pDataObject);
  274. break;
  275. #if 0
  276. case IDM_TBB_PRINT:
  277. pExtendContextMenu()->Command(CSystemInfoScope::IDM_PRINT, pDataObject);
  278. break;
  279. #endif
  280. case IDM_TBB_REPORT:
  281. pExtendContextMenu()->Command(CSystemInfoScope::IDM_SAVEREPORT, pDataObject);
  282. break;
  283. default:
  284. ASSERT(FALSE);
  285. break;
  286. }
  287. return S_OK;
  288. }
  289. /*
  290. * CustomToolbarHandler - Handle the MSInfo-specific toolbar selection event.
  291. * Note this also handles the toolbar deselect all event.
  292. *
  293. * History: a-jsari 9/24/97 Initial version
  294. */
  295. HRESULT CSystemInfo::OnControlbarSelect(BOOL fDeselectAll, LPARAM lSelection,
  296. LPDATAOBJECT)
  297. {
  298. #if 0
  299. ASSERT(IsPrimaryImpl());
  300. if (IsPrimaryImpl() == FALSE) return S_OK;
  301. #endif
  302. HRESULT hr;
  303. // Split selection into scope/selection.
  304. BOOL bScope = (BOOL) LOWORD(lSelection);
  305. BOOL bSelect = (BOOL) HIWORD(lSelection);
  306. if (fDeselectAll) bSelect = FALSE;
  307. do {
  308. hr = EnableToolbar(bSelect);
  309. if (FAILED(hr)) break;
  310. hr = EnableSupportTools(bSelect);
  311. } while (0);
  312. return hr;
  313. }
  314. /*
  315. * OnDoubleClick - Handler for Double click event
  316. *
  317. * History: a-jsari 10/3/97 Stub version
  318. */
  319. HRESULT CSystemInfo::OnDoubleClick(LPDATAOBJECT pDataObject)
  320. {
  321. CDataObject *pdoSelection = GetInternalFromDataObject(pDataObject);
  322. if(NULL == pdoSelection)
  323. return E_FAIL;
  324. // Allow MMC to open the scope node..
  325. if (pdoSelection->Context() == CCT_SCOPE) return S_FALSE;
  326. return S_OK;
  327. }
  328. /*
  329. * OnMenuButtonClick - Handle the SupportTool MENUBUTTON Button click event.
  330. *
  331. * History: a-jsari 9/18/97 Initial version.
  332. */
  333. HRESULT CSystemInfo::OnMenuButtonClick(LPDATAOBJECT *ppDataObject,
  334. LPMENUBUTTONDATA pMenuData)
  335. {
  336. AFX_MANAGE_STATE(::AfxGetStaticModuleState());
  337. ASSERT(ppDataObject != NULL);
  338. ASSERT(pMenuData != NULL);
  339. if (ppDataObject == NULL || pMenuData == NULL) return E_POINTER;
  340. // Get the pop-up menu we will use to process our commands.
  341. CMenu *pMenu = m_mnuSupport.GetSubMenu(0);
  342. if (pMenu == NULL) return S_FALSE;
  343. unsigned long lCommand = pMenu->TrackPopupMenu(TPM_RETURNCMD | TPM_NONOTIFY,
  344. pMenuData->x, pMenuData->y, ::AfxGetMainWnd());
  345. // We track both the Toolset index and the Tool index with a single long,
  346. // bit-shifting and or'ing them together into lCommand.
  347. //
  348. // The lCommand item is the index of the Toolset left-shifted 8 times
  349. // or'd with the index of the Tool
  350. // lCommand == 0 is the value for items we didn't set.
  351. if (lCommand != 0)
  352. (*m_plistTools)[lCommand >> 8]->RunTool((lCommand & 0xff) - 1);
  353. return S_OK;
  354. }
  355. /*
  356. * OnPrint - Handle the print event.
  357. *
  358. * History: a-jsari 2/26/98 Initial version
  359. */
  360. HRESULT CSystemInfo::OnPrint()
  361. {
  362. dynamic_cast<CSystemInfoScope *>(pComponentData())->PrintReport();
  363. return S_OK;
  364. }
  365. /*
  366. * OnProperties - Handle the VERB_PROPERTIES event.
  367. *
  368. * History: a-jsari 10/3/97 Stub version.
  369. */
  370. HRESULT CSystemInfo::OnProperties(LPDATAOBJECT)
  371. {
  372. return S_OK;
  373. }
  374. /*
  375. * OnPropertyChange - Handle the property change event.
  376. *
  377. * History: a-jsari 9/1/97 Stub version
  378. */
  379. HRESULT CSystemInfo::OnPropertyChange(LPDATAOBJECT lpdo)
  380. {
  381. return dynamic_cast<CSystemInfoScope *>(pComponentData())->OnProperties((LPARAM)lpdo);
  382. }
  383. /*
  384. * OnRefresh - Handle the refresh event.
  385. *
  386. * History: a-jsari 10/3/97 Initial version
  387. */
  388. HRESULT CSystemInfo::OnRefresh(LPDATAOBJECT)
  389. {
  390. dynamic_cast<CSystemInfoScope *>(pComponentData())->Refresh(m_pfLast, this);
  391. return S_OK;
  392. }
  393. /*
  394. * OnSelect - Called when any node is selected or deselected.
  395. *
  396. * History: a-jsari 9/24/97 Initial version
  397. */
  398. HRESULT CSystemInfo::OnSelect(LPDATAOBJECT pDataObject, LPARAM lSelection)
  399. {
  400. HRESULT hr = S_OK;
  401. hr = HandleStandardVerbs(LOWORD(lSelection), pDataObject); // LOWORD(lSelection) is scope flag
  402. // It turns out that it's better to handle drawing the contents of a category
  403. // only on the SHOW message (rather than the SELECT message). This avoids showing
  404. // data for a category which wasn't fully selected (i.e. right click, then ESC
  405. // from the context menu).
  406. return hr;
  407. #if FALSE
  408. HRESULT hr = S_OK;
  409. do
  410. {
  411. BOOL fSelect = HIWORD(lSelection);
  412. BOOL fScope = LOWORD(lSelection);
  413. hr = HandleStandardVerbs(fScope, pDataObject);
  414. if (FAILED(hr)) break;
  415. CDataObject * pdoLast = GetInternalFromDataObject(pDataObject);
  416. // If the folder is being deselected, check to see if it is currently
  417. // being refreshed. If it is, change the variable so the threaded
  418. // refresh knows not to update the display.
  419. if (fScope && !fSelect)
  420. {
  421. if (pdoLast->Category() == m_pLastRefreshedFolder)
  422. m_pLastRefreshedFolder = NULL;
  423. }
  424. // We handle it if it's a scope item and is being selected.
  425. if (fScope && fSelect)
  426. {
  427. // Remember the last selection for OnViewChange.
  428. ASSERT(pdoLast != NULL);
  429. ASSERT(pdoLast->Context() == CCT_SCOPE);
  430. // Remember the last selected Folder.
  431. m_pfLast = pdoLast->Category();
  432. m_pLastRefreshedFolder = m_pfLast;
  433. DisplayFolder(m_pfLast);
  434. dynamic_cast<CSystemInfoScope *>(pComponentData())->SetSelectedFolder(m_pfLast);
  435. }
  436. } while (0);
  437. return hr;
  438. #endif
  439. }
  440. /*
  441. * DisplayFolder - Display all result-pane data for the current folder.
  442. *
  443. * History: a-jsari 12/11/97 Initial version
  444. */
  445. HRESULT CSystemInfo::DisplayFolder(CFolder *pFolder)
  446. {
  447. HRESULT hr;
  448. if (pFolder && pFolder->GetType() == CDataSource::OCX)
  449. {
  450. // If the refresh fails (for instance, if there is no OCX installed to show
  451. // the stream), display a message (unless this is the root node).
  452. COCXFolder * pOCXFolder = reinterpret_cast<COCXFolder *>(pFolder);
  453. LPOLESTR lpCLSID;
  454. if (pOCXFolder && SUCCEEDED(StringFromCLSID(pOCXFolder->m_clsid, &lpCLSID)))
  455. {
  456. CString strCLSID(lpCLSID);
  457. CoTaskMemFree(lpCLSID);
  458. IUnknown * pUnknown = NULL;
  459. m_mapCLSIDToIUnknown.Lookup(strCLSID, (void*&) pUnknown);
  460. if (!pOCXFolder->Refresh(pUnknown) && pFolder->GetParentNode() && pFolder->GetChildNode() == NULL)
  461. SetRefreshing(lparamNoOCXIndicator);
  462. }
  463. return S_OK;
  464. }
  465. CSystemInfoScope * pSysScope = dynamic_cast<CSystemInfoScope *>(pComponentData());
  466. if (pSysScope && pSysScope->InRefresh() && pFolder && pFolder->GetChildNode() == NULL)
  467. {
  468. SetRefreshing(lparamRefreshIndicator);
  469. return S_OK;
  470. }
  471. do {
  472. hr = ClearResultsPane();
  473. ASSERT(hr == S_OK);
  474. if (FAILED(hr)) break;
  475. // Create this folder's header columns
  476. hr = SetResultHeaderColumns(pFolder);
  477. if (FAILED(hr)) break;
  478. // Display all values under those column headers.
  479. hr = EnumerateValues(pFolder);
  480. } while (FALSE);
  481. return hr;
  482. }
  483. /*
  484. * OnShow - Notification when a scope item gets its first selection, or
  485. * when the Snap-in is being unloaded.
  486. *
  487. * History: a-jsari 10/2/97 Initial version
  488. */
  489. HRESULT CSystemInfo::OnShow(LPDATAOBJECT pDataObject, LPARAM fActive, HSCOPEITEM)
  490. {
  491. HRESULT hr = S_OK;
  492. CDataObject * pdoSelection = GetInternalFromDataObject(pDataObject);
  493. if (!fActive)
  494. {
  495. // If the folder is being deselected, check to see if it is currently
  496. // being refreshed. If it is, change the variable so the threaded
  497. // refresh knows not to update the display.
  498. if (pdoSelection->Category() == m_pLastRefreshedFolder)
  499. m_pLastRefreshedFolder = NULL;
  500. return hr;
  501. }
  502. do
  503. {
  504. ASSERT(pdoSelection != NULL);
  505. ASSERT(pdoSelection->Context() == CCT_SCOPE);
  506. CFolder * pfolSelection = pdoSelection->Category();
  507. m_pLastRefreshedFolder = pfolSelection;
  508. dynamic_cast<CSystemInfoScope *>(pComponentData())->RefreshAsync(pfolSelection, this);
  509. // Remember the last selected Folder.
  510. m_pfLast = pfolSelection;
  511. dynamic_cast<CSystemInfoScope *>(pComponentData())->SetSelectedFolder(m_pfLast);
  512. // Folders may be NULL if Initialize fails.
  513. if (pfolSelection != NULL)
  514. {
  515. hr = DisplayFolder(pfolSelection);
  516. hr = HandleStandardVerbs((BOOL)fActive, pDataObject);
  517. }
  518. } while (0);
  519. return hr;
  520. }
  521. /*
  522. * OnUpdateView - Handle the view update event
  523. *
  524. * History: a-jsari 9/1/97 Stub version
  525. */
  526. HRESULT CSystemInfo::OnUpdateView(LPARAM arg)
  527. {
  528. HRESULT hr = S_OK;
  529. // arg != 0 is passed by CSystemInfoScope::OpenFile
  530. if (m_pfLast != NULL && arg == 0) {
  531. hr = DisplayFolder(m_pfLast);
  532. }
  533. // Do this so that the refresh verb goes away when we load a file.
  534. SetInitialVerbState(TRUE);
  535. return hr;
  536. }