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.

1469 lines
37 KiB

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) 1999 Microsoft Corporation
  4. //
  5. // Module Name:
  6. // BasePage.cpp
  7. //
  8. // Description:
  9. // Implementation of the CBasePropertyPage class.
  10. //
  11. // Author:
  12. // David Potter (DavidP) March 24, 1999
  13. //
  14. // Revision History:
  15. //
  16. // Notes:
  17. //
  18. /////////////////////////////////////////////////////////////////////////////
  19. #include "stdafx.h"
  20. #include "ClNetResEx.h"
  21. #include "ExtObj.h"
  22. #include "BasePage.h"
  23. #include "BasePage.inl"
  24. #ifdef _DEBUG
  25. #define new DEBUG_NEW
  26. #undef THIS_FILE
  27. static char THIS_FILE[] = __FILE__;
  28. #endif
  29. /////////////////////////////////////////////////////////////////////////////
  30. // CBasePropertyPage property page
  31. /////////////////////////////////////////////////////////////////////////////
  32. IMPLEMENT_DYNCREATE( CBasePropertyPage, CPropertyPage )
  33. /////////////////////////////////////////////////////////////////////////////
  34. // Message Maps
  35. BEGIN_MESSAGE_MAP( CBasePropertyPage, CPropertyPage )
  36. //{{AFX_MSG_MAP(CBasePropertyPage)
  37. ON_WM_CREATE()
  38. ON_WM_DESTROY()
  39. ON_WM_HELPINFO()
  40. ON_WM_CONTEXTMENU()
  41. ON_MESSAGE(WM_COMMANDHELP, OnCommandHelp)
  42. //}}AFX_MSG_MAP
  43. END_MESSAGE_MAP()
  44. /////////////////////////////////////////////////////////////////////////////
  45. //++
  46. //
  47. // CBasePropertyPage::CBasePropertyPage
  48. //
  49. // Description:
  50. // Default constructor.
  51. //
  52. // Arguments:
  53. // None.
  54. //
  55. // Return Value:
  56. // None.
  57. //
  58. //--
  59. /////////////////////////////////////////////////////////////////////////////
  60. CBasePropertyPage::CBasePropertyPage( void )
  61. {
  62. CommonConstruct();
  63. } //*** CBasePropertyPage::CBasePropertyPage()
  64. /////////////////////////////////////////////////////////////////////////////
  65. //++
  66. //
  67. // CBasePropertyPage::CBasePropertyPage
  68. //
  69. // Routine Description:
  70. // Default constructor.
  71. //
  72. // Arguments:
  73. // pdwHelpMap [IN] Control-to-help ID map.
  74. // pdwWizardHelpMap [IN] Control-to-help ID map if this is a wizard page.
  75. //
  76. // Return Value:
  77. // None.
  78. //
  79. //--
  80. /////////////////////////////////////////////////////////////////////////////
  81. CBasePropertyPage::CBasePropertyPage(
  82. IN const DWORD * pdwHelpMap,
  83. IN const DWORD * pdwWizardHelpMap
  84. )
  85. : m_dlghelp( pdwHelpMap, 0 )
  86. {
  87. CommonConstruct();
  88. m_pdwWizardHelpMap = pdwWizardHelpMap;
  89. } //*** CBasePropertyPage::CBasePropertyPage()
  90. /////////////////////////////////////////////////////////////////////////////
  91. //++
  92. //
  93. // CBasePropertyPage::CBasePropertyPage
  94. //
  95. // Routine Description:
  96. // Default constructor.
  97. //
  98. // Arguments:
  99. // idd [IN] Dialog template resource ID.
  100. // pdwHelpMap [IN] Control-to-help ID map.
  101. // pdwWizardHelpMap [IN] Control-to-help ID map if this is a wizard page.
  102. // nIDCaption [IN] Caption string resource ID.
  103. //
  104. // Return Value:
  105. // None.
  106. //
  107. //--
  108. /////////////////////////////////////////////////////////////////////////////
  109. CBasePropertyPage::CBasePropertyPage(
  110. IN UINT idd,
  111. IN const DWORD * pdwHelpMap,
  112. IN const DWORD * pdwWizardHelpMap,
  113. IN UINT nIDCaption
  114. )
  115. : CPropertyPage( idd, nIDCaption )
  116. , m_dlghelp( pdwHelpMap, idd )
  117. {
  118. CommonConstruct();
  119. m_pdwWizardHelpMap = pdwWizardHelpMap;
  120. } //*** CBasePropertyPage::CBasePropertyPage( UINT, UINT )
  121. /////////////////////////////////////////////////////////////////////////////
  122. //++
  123. //
  124. // CBasePropertyPage::CommonConstruct
  125. //
  126. // Description:
  127. // Common construction.
  128. //
  129. // Arguments:
  130. // None.
  131. //
  132. // Return Value:
  133. // None.
  134. //
  135. //--
  136. /////////////////////////////////////////////////////////////////////////////
  137. void CBasePropertyPage::CommonConstruct( void )
  138. {
  139. //{{AFX_DATA_INIT(CBasePropertyPage)
  140. //}}AFX_DATA_INIT
  141. m_peo = NULL;
  142. m_hpage = NULL;
  143. m_bBackPressed = FALSE;
  144. m_bSaved = FALSE;
  145. m_iddPropertyPage = NULL;
  146. m_iddWizardPage = NULL;
  147. m_idsCaption = NULL;
  148. m_pdwWizardHelpMap = NULL;
  149. m_bDoDetach = FALSE;
  150. } //*** CBasePropertyPage::CommonConstruct()
  151. /////////////////////////////////////////////////////////////////////////////
  152. //++
  153. //
  154. // CBasePropertyPage::HrInit
  155. //
  156. // Description:
  157. // Initialize the page.
  158. //
  159. // Arguments:
  160. // peo [IN OUT] Pointer to the extension object.
  161. //
  162. // Return Value:
  163. // S_OK Page initialized successfully.
  164. // hr Page failed to initialize.
  165. //
  166. //--
  167. /////////////////////////////////////////////////////////////////////////////
  168. HRESULT CBasePropertyPage::HrInit( IN OUT CExtObject * peo )
  169. {
  170. ASSERT( peo != NULL );
  171. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  172. HRESULT _hr = S_FALSE;
  173. CWaitCursor _wc;
  174. do
  175. {
  176. m_peo = peo;
  177. // Change the help map if this is a wizard page.
  178. if ( Peo()->BWizard() )
  179. {
  180. m_dlghelp.SetMap( m_pdwWizardHelpMap );
  181. } // if: in a wizard
  182. // Don't display a help button.
  183. m_psp.dwFlags &= ~PSP_HASHELP;
  184. // Construct the property page.
  185. if ( Peo()->BWizard() )
  186. {
  187. ASSERT( IddWizardPage() != NULL);
  188. Construct( IddWizardPage(), IdsCaption() );
  189. m_dlghelp.SetHelpMask( IddWizardPage() );
  190. } // if: adding page to wizard
  191. else
  192. {
  193. ASSERT( IddPropertyPage() != NULL );
  194. Construct( IddPropertyPage(), IdsCaption() );
  195. m_dlghelp.SetHelpMask( IddPropertyPage() );
  196. } // else: adding page to property sheet
  197. // Read the properties private to this resource and parse them.
  198. {
  199. DWORD _sc = ERROR_SUCCESS;
  200. CClusPropList _cpl;
  201. ASSERT( Peo() != NULL );
  202. ASSERT( Peo()->PodObjData() );
  203. // Read the properties.
  204. switch ( Cot() )
  205. {
  206. case CLUADMEX_OT_NODE:
  207. ASSERT( Peo()->PndNodeData()->m_hnode != NULL );
  208. _sc = _cpl.ScGetNodeProperties(
  209. Peo()->PndNodeData()->m_hnode,
  210. CLUSCTL_NODE_GET_PRIVATE_PROPERTIES
  211. );
  212. break;
  213. case CLUADMEX_OT_GROUP:
  214. ASSERT( Peo()->PgdGroupData()->m_hgroup != NULL );
  215. _sc = _cpl.ScGetGroupProperties(
  216. Peo()->PgdGroupData()->m_hgroup,
  217. CLUSCTL_GROUP_GET_PRIVATE_PROPERTIES
  218. );
  219. break;
  220. case CLUADMEX_OT_RESOURCE:
  221. ASSERT( Peo()->PrdResData()->m_hresource != NULL );
  222. _sc = _cpl.ScGetResourceProperties(
  223. Peo()->PrdResData()->m_hresource,
  224. CLUSCTL_RESOURCE_GET_PRIVATE_PROPERTIES
  225. );
  226. break;
  227. case CLUADMEX_OT_RESOURCETYPE:
  228. ASSERT( Peo()->PodObjData()->m_strName.GetLength() > 0 );
  229. _sc = _cpl.ScGetResourceTypeProperties(
  230. Hcluster(),
  231. Peo()->PodObjData()->m_strName,
  232. CLUSCTL_RESOURCE_TYPE_GET_PRIVATE_PROPERTIES
  233. );
  234. break;
  235. case CLUADMEX_OT_NETWORK:
  236. ASSERT( Peo()->PndNetworkData()->m_hnetwork != NULL );
  237. _sc = _cpl.ScGetNetworkProperties(
  238. Peo()->PndNetworkData()->m_hnetwork,
  239. CLUSCTL_NETWORK_GET_PRIVATE_PROPERTIES
  240. );
  241. break;
  242. case CLUADMEX_OT_NETINTERFACE:
  243. ASSERT( Peo()->PndNetInterfaceData()->m_hnetinterface != NULL );
  244. _sc = _cpl.ScGetNetInterfaceProperties(
  245. Peo()->PndNetInterfaceData()->m_hnetinterface,
  246. CLUSCTL_NETINTERFACE_GET_PRIVATE_PROPERTIES
  247. );
  248. break;
  249. default:
  250. ASSERT( 0 );
  251. } // switch: object type
  252. // Parse the properties.
  253. if ( _sc == ERROR_SUCCESS )
  254. {
  255. // Parse the properties.
  256. try
  257. {
  258. _sc = ScParseProperties( _cpl );
  259. } // try
  260. catch ( CMemoryException * _pme )
  261. {
  262. _hr = E_OUTOFMEMORY;
  263. _pme->Delete();
  264. } // catch: CMemoryException
  265. } // if: properties read successfully
  266. if ( _sc != ERROR_SUCCESS )
  267. {
  268. _hr = HRESULT_FROM_WIN32( _sc );
  269. break;
  270. } // if: error parsing getting or parsing properties
  271. } // Read the properties private to this resource and parse them
  272. } while ( 0 );
  273. return _hr;
  274. } //*** CBasePropertyPage::HrInit()
  275. /////////////////////////////////////////////////////////////////////////////
  276. //++
  277. //
  278. // CBasePropertyPage::HrCreatePage
  279. //
  280. // Description:
  281. // Create the page.
  282. //
  283. // Arguments:
  284. // None.
  285. //
  286. // Return Value:
  287. // S_OK Page created successfully.
  288. // hr Error creating the page.
  289. //
  290. //--
  291. /////////////////////////////////////////////////////////////////////////////
  292. HRESULT CBasePropertyPage::HrCreatePage( void )
  293. {
  294. ASSERT( m_hpage == NULL );
  295. HRESULT _hr = S_OK;
  296. m_hpage = CreatePropertySheetPage( &m_psp );
  297. if ( m_hpage == NULL )
  298. {
  299. _hr = HRESULT_FROM_WIN32( GetLastError() );
  300. } // if: error creating the page
  301. return _hr;
  302. } //*** CBasePropertyPage::HrCreatePage()
  303. /////////////////////////////////////////////////////////////////////////////
  304. //++
  305. //
  306. // CBasePropertyPage::ScParseProperties
  307. //
  308. // Description:
  309. // Parse the properties of the resource. This is in a separate function
  310. // from HrInit so that the optimizer can do a better job.
  311. //
  312. // Arguments:
  313. // rcpl [IN] Cluster property list to parse.
  314. //
  315. // Return Values:
  316. // ERROR_SUCCESS Properties were parsed successfully.
  317. // Any error returns from ScParseUnknownProperty().
  318. //
  319. // Exceptions Thrown:
  320. // Any exceptions from CString::operator=().
  321. //
  322. //--
  323. /////////////////////////////////////////////////////////////////////////////
  324. DWORD CBasePropertyPage::ScParseProperties( IN CClusPropList & rcpl )
  325. {
  326. DWORD _sc;
  327. DWORD _cprop;
  328. const CObjectProperty * _pprop;
  329. ASSERT( rcpl.PbPropList() != NULL );
  330. _sc = rcpl.ScMoveToFirstProperty();
  331. while ( _sc == ERROR_SUCCESS )
  332. {
  333. //
  334. // Parse known properties.
  335. //
  336. for ( _pprop = Pprops(), _cprop = Cprops() ; _cprop > 0 ; _pprop++, _cprop-- )
  337. {
  338. if ( lstrcmpiW( rcpl.PszCurrentPropertyName(), _pprop->m_pwszName ) == 0 )
  339. {
  340. if ( rcpl.CpfCurrentValueFormat() == _pprop->m_propFormat )
  341. {
  342. switch ( _pprop->m_propFormat )
  343. {
  344. case CLUSPROP_FORMAT_SZ:
  345. case CLUSPROP_FORMAT_EXPAND_SZ:
  346. ASSERT( (rcpl.CbCurrentValueLength() == (lstrlenW( rcpl.CbhCurrentValue().pStringValue->sz ) + 1) * sizeof( WCHAR ))
  347. || ( (rcpl.CbCurrentValueLength() == 0)
  348. && (rcpl.CbhCurrentValue().pStringValue->sz[ 0 ] == L'\0') ) );
  349. *_pprop->m_value.pstr = rcpl.CbhCurrentValue().pStringValue->sz;
  350. *_pprop->m_valuePrev.pstr = rcpl.CbhCurrentValue().pStringValue->sz;
  351. // See if we need to find an expanded version
  352. if ( _pprop->m_valueEx.pstr != NULL )
  353. {
  354. // Copy the non-expanded one just in case there isn't an expanded version
  355. *_pprop->m_valueEx.pstr = rcpl.CbhCurrentValue().pStringValue->sz;
  356. // See if they included an expanded version
  357. rcpl.ScMoveToNextPropertyValue( );
  358. if ( rcpl.CpfCurrentValueFormat( ) == CLUSPROP_FORMAT_EXPANDED_SZ )
  359. {
  360. *_pprop->m_valueEx.pstr = rcpl.CbhCurrentValue().pStringValue->sz;
  361. } // if: found expanded version
  362. } // if: *_pprop->m_valueEx.pstr is present
  363. break;
  364. case CLUSPROP_FORMAT_EXPANDED_SZ:
  365. ASSERT( (rcpl.CbCurrentValueLength() == (lstrlenW( rcpl.CbhCurrentValue().pStringValue->sz ) + 1) * sizeof( WCHAR ))
  366. || ( (rcpl.CbCurrentValueLength() == 0)
  367. && (rcpl.CbhCurrentValue().pStringValue->sz[ 0 ] == L'\0') ) );
  368. *_pprop->m_value.pstr = rcpl.CbhCurrentValue().pStringValue->sz;
  369. *_pprop->m_valuePrev.pstr = rcpl.CbhCurrentValue().pStringValue->sz;
  370. // See if we need to find an expanded version
  371. if ( _pprop->m_valueEx.pstr != NULL )
  372. {
  373. // Copy the expanded version
  374. *_pprop->m_valueEx.pstr = rcpl.CbhCurrentValue().pStringValue->sz;
  375. // See if they included a non-expanded version
  376. rcpl.ScMoveToNextPropertyValue( );
  377. if ( rcpl.CpfCurrentValueFormat( ) == CLUSPROP_FORMAT_SZ )
  378. {
  379. *_pprop->m_value.pstr = rcpl.CbhCurrentValue().pStringValue->sz;
  380. *_pprop->m_valuePrev.pstr = rcpl.CbhCurrentValue().pStringValue->sz;
  381. } // if: found non-expanded version
  382. } // if: *_pprop->m_valueEx.pstr is present
  383. break;
  384. case CLUSPROP_FORMAT_DWORD:
  385. case CLUSPROP_FORMAT_LONG:
  386. ASSERT( rcpl.CbCurrentValueLength() == sizeof( DWORD ) );
  387. *_pprop->m_value.pdw = rcpl.CbhCurrentValue().pDwordValue->dw;
  388. *_pprop->m_valuePrev.pdw = rcpl.CbhCurrentValue().pDwordValue->dw;
  389. break;
  390. case CLUSPROP_FORMAT_BINARY:
  391. case CLUSPROP_FORMAT_MULTI_SZ:
  392. *_pprop->m_value.ppb = rcpl.CbhCurrentValue().pBinaryValue->rgb;
  393. *_pprop->m_value.pcb = rcpl.CbhCurrentValue().pBinaryValue->cbLength;
  394. *_pprop->m_valuePrev.ppb = rcpl.CbhCurrentValue().pBinaryValue->rgb;
  395. *_pprop->m_valuePrev.pcb = rcpl.CbhCurrentValue().pBinaryValue->cbLength;
  396. break;
  397. default:
  398. ASSERT(0); // don't know how to deal with this type
  399. } // switch: property format
  400. // Exit the loop since we found the parameter.
  401. break;
  402. }// if: found a type match
  403. } // if: found a string match
  404. } // for: each property that we know about
  405. //
  406. // If the property wasn't known, ask the derived class to parse it.
  407. //
  408. if ( _cprop == 0 )
  409. {
  410. _sc = ScParseUnknownProperty(
  411. rcpl.CbhCurrentPropertyName().pName->sz,
  412. rcpl.CbhCurrentValue(),
  413. rcpl.RPvlPropertyValue().CbDataLeft()
  414. );
  415. if ( _sc != ERROR_SUCCESS )
  416. {
  417. return _sc;
  418. } // if: error parsing the unknown property
  419. } // if: property not parsed
  420. //
  421. // Advance the buffer pointer past the value in the value list.
  422. //
  423. _sc = rcpl.ScMoveToNextProperty();
  424. } // while: more properties to parse
  425. //
  426. // If we reached the end of the properties, fix the return code.
  427. //
  428. if ( _sc == ERROR_NO_MORE_ITEMS )
  429. {
  430. _sc = ERROR_SUCCESS;
  431. } // if: ended loop after parsing all properties
  432. return _sc;
  433. } //*** CBasePropertyPage::ScParseProperties()
  434. /////////////////////////////////////////////////////////////////////////////
  435. //++
  436. //
  437. // CBasePropertyPage::OnCreate
  438. //
  439. // Description:
  440. // Handler for the WM_CREATE message.
  441. //
  442. // Arguments:
  443. // lpCreateStruct [IN OUT] Window create structure.
  444. //
  445. // Return Value:
  446. // -1 Error.
  447. // 0 Success.
  448. //
  449. //--
  450. /////////////////////////////////////////////////////////////////////////////
  451. int CBasePropertyPage::OnCreate( LPCREATESTRUCT lpCreateStruct )
  452. {
  453. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  454. // Attach the window to the property page structure.
  455. // This has been done once already in the main application, since the
  456. // main application owns the property sheet. It needs to be done here
  457. // so that the window handle can be found in the DLL's handle map.
  458. if ( FromHandlePermanent( m_hWnd ) == NULL ) // is the window handle already in the handle map
  459. {
  460. HWND _hWnd = m_hWnd;
  461. m_hWnd = NULL;
  462. Attach( _hWnd );
  463. m_bDoDetach = TRUE;
  464. } // if: is the window handle in the handle map
  465. return CPropertyPage::OnCreate( lpCreateStruct );
  466. } //*** CBasePropertyPage::OnCreate()
  467. /////////////////////////////////////////////////////////////////////////////
  468. //++
  469. //
  470. // CBasePropertyPage::OnDestroy
  471. //
  472. // Description:
  473. // Handler for the WM_DESTROY message.
  474. //
  475. // Arguments:
  476. // None.
  477. //
  478. // Return Value:
  479. // None.
  480. //
  481. //--
  482. /////////////////////////////////////////////////////////////////////////////
  483. void CBasePropertyPage::OnDestroy( void )
  484. {
  485. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  486. // Detach the window from the property page structure.
  487. // This will be done again by the main application, since it owns the
  488. // property sheet. It needs to be done here so that the window handle
  489. // can be removed from the DLL's handle map.
  490. if ( m_bDoDetach )
  491. {
  492. if ( m_hWnd != NULL )
  493. {
  494. HWND _hWnd = m_hWnd;
  495. Detach();
  496. m_hWnd = _hWnd;
  497. } // if: do we have a window handle?
  498. } // if: do we need to balance the attach we did with a detach?
  499. CPropertyPage::OnDestroy();
  500. } //*** CBasePropertyPage::OnDestroy()
  501. /////////////////////////////////////////////////////////////////////////////
  502. //++
  503. //
  504. // CBasePropertyPage::DoDataExchange
  505. //
  506. // Description:
  507. // Do data exchange between the dialog and the class.
  508. //
  509. // Arguments:
  510. // pDX [IN OUT] Data exchange object
  511. //
  512. // Return Value:
  513. // None.
  514. //
  515. //--
  516. /////////////////////////////////////////////////////////////////////////////
  517. void CBasePropertyPage::DoDataExchange( CDataExchange * pDX )
  518. {
  519. if ( ! pDX->m_bSaveAndValidate || ! BSaved() )
  520. {
  521. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  522. //{{AFX_DATA_MAP(CBasePropertyPage)
  523. // NOTE: the ClassWizard will add DDX and DDV calls here
  524. //}}AFX_DATA_MAP
  525. DDX_Control( pDX, IDC_PP_ICON, m_staticIcon );
  526. DDX_Control( pDX, IDC_PP_TITLE, m_staticTitle );
  527. if ( pDX->m_bSaveAndValidate )
  528. {
  529. if ( ! BBackPressed() )
  530. {
  531. CWaitCursor _wc;
  532. // Validate the data.
  533. if ( ! BSetPrivateProps( TRUE /*bValidateOnly*/ ) )
  534. {
  535. pDX->Fail();
  536. } // if: error setting private properties
  537. } // if: Back button not pressed
  538. } // if: saving data from dialog
  539. else
  540. {
  541. // Set the title.
  542. DDX_Text( pDX, IDC_PP_TITLE, m_strTitle );
  543. } // if: not saving data
  544. } // if: not saving or haven't saved yet
  545. // Call the base class method.
  546. CPropertyPage::DoDataExchange( pDX );
  547. } //*** CBasePropertyPage::DoDataExchange()
  548. /////////////////////////////////////////////////////////////////////////////
  549. //++
  550. //
  551. // CBasePropertyPage::OnInitDialog
  552. //
  553. // Description:
  554. // Handler for the WM_INITDIALOG message.
  555. //
  556. // Arguments:
  557. // None.
  558. //
  559. // Return Value:
  560. // TRUE We need the focus to be set for us.
  561. // FALSE We already set the focus to the proper control.
  562. //
  563. //--
  564. /////////////////////////////////////////////////////////////////////////////
  565. BOOL CBasePropertyPage::OnInitDialog( void )
  566. {
  567. ASSERT( Peo() != NULL );
  568. ASSERT( Peo()->PodObjData() != NULL );
  569. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  570. // Set the title string.
  571. m_strTitle = Peo()->PodObjData()->m_strName;
  572. // Call the base class method.
  573. CPropertyPage::OnInitDialog();
  574. // Display an icon for the object.
  575. if ( Peo()->Hicon() != NULL )
  576. {
  577. m_staticIcon.SetIcon( Peo()->Hicon() );
  578. } // if: an icon was specified
  579. return TRUE; // return TRUE unless you set the focus to a control
  580. // EXCEPTION: OCX Property Pages should return FALSE
  581. } //*** CBasePropertyPage::OnInitDialog()
  582. /////////////////////////////////////////////////////////////////////////////
  583. //++
  584. //
  585. // CBasePropertyPage::OnSetActive
  586. //
  587. // Description:
  588. // Handler for the PSN_SETACTIVE message.
  589. //
  590. // Arguments:
  591. // None.
  592. //
  593. // Return Value:
  594. // TRUE Page successfully initialized.
  595. // FALSE Page not initialized.
  596. //
  597. //--
  598. /////////////////////////////////////////////////////////////////////////////
  599. BOOL CBasePropertyPage::OnSetActive( void )
  600. {
  601. HRESULT _hr;
  602. ASSERT( Peo() != NULL);
  603. ASSERT( Peo()->PodObjData() != NULL );
  604. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  605. // Reread the data.
  606. _hr = Peo()->HrGetObjectInfo();
  607. if ( _hr != NOERROR )
  608. {
  609. return FALSE;
  610. } // if: error getting object info
  611. // Set the title string.
  612. m_strTitle = Peo()->PodObjData()->m_strName;
  613. m_bBackPressed = FALSE;
  614. m_bSaved = FALSE;
  615. return CPropertyPage::OnSetActive();
  616. } //*** CBasePropertyPage::OnSetActive()
  617. /////////////////////////////////////////////////////////////////////////////
  618. //++
  619. //
  620. // CBasePropertyPage::OnApply
  621. //
  622. // Description:
  623. // Handler for the PSM_APPLY message.
  624. //
  625. // Arguments:
  626. // None.
  627. //
  628. // Return Value:
  629. // TRUE Page successfully applied.
  630. // FALSE Error applying page.
  631. //
  632. //--
  633. /////////////////////////////////////////////////////////////////////////////
  634. BOOL CBasePropertyPage::OnApply( void )
  635. {
  636. ASSERT( ! BWizard() );
  637. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  638. CWaitCursor _wc;
  639. if ( ! BApplyChanges() )
  640. {
  641. return FALSE;
  642. } // if: error applying changes
  643. return CPropertyPage::OnApply();
  644. } //*** CBasePropertyPage::OnApply()
  645. /////////////////////////////////////////////////////////////////////////////
  646. //++
  647. //
  648. // CBasePropertyPage::OnWizardBack
  649. //
  650. // Description:
  651. // Handler for the PSN_WIZBACK message.
  652. //
  653. // Arguments:
  654. // None.
  655. //
  656. // Return Value:
  657. // -1 Don't change the page.
  658. // 0 Change the page.
  659. //
  660. //--
  661. /////////////////////////////////////////////////////////////////////////////
  662. LRESULT CBasePropertyPage::OnWizardBack( void )
  663. {
  664. LRESULT _lResult;
  665. ASSERT( BWizard() );
  666. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  667. _lResult = CPropertyPage::OnWizardBack();
  668. if ( _lResult != -1 )
  669. {
  670. m_bBackPressed = TRUE;
  671. } // if: no error occurred
  672. return _lResult;
  673. } //*** CBasePropertyPage::OnWizardBack()
  674. /////////////////////////////////////////////////////////////////////////////
  675. //++
  676. //
  677. // CBasePropertyPage::OnWizardNext
  678. //
  679. // Description:
  680. // Handler for the PSN_WIZNEXT message.
  681. //
  682. // Arguments:
  683. // None.
  684. //
  685. // Return Value:
  686. // -1 Don't change the page.
  687. // 0 Change the page.
  688. //
  689. //--
  690. /////////////////////////////////////////////////////////////////////////////
  691. LRESULT CBasePropertyPage::OnWizardNext( void )
  692. {
  693. ASSERT( BWizard() );
  694. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  695. CWaitCursor _wc;
  696. // Update the data in the class from the page.
  697. // This necessary because, while OnKillActive() will call UpdateData(),
  698. // it is called after this method is called, and we need to be sure that
  699. // data has been saved before we apply them.
  700. if ( ! UpdateData( TRUE /*bSaveAndValidate*/ ) )
  701. {
  702. return -1;
  703. } // if: error updating data
  704. // Save the data in the sheet.
  705. if ( ! BApplyChanges() )
  706. {
  707. return -1;
  708. } // if: error applying changes
  709. // Create the object.
  710. return CPropertyPage::OnWizardNext();
  711. } //*** CBasePropertyPage::OnWizardNext()
  712. /////////////////////////////////////////////////////////////////////////////
  713. //++
  714. //
  715. // CBasePropertyPage::OnWizardFinish
  716. //
  717. // Description:
  718. // Handler for the PSN_WIZFINISH message.
  719. //
  720. // Arguments:
  721. // None.
  722. //
  723. // Return Value:
  724. // FALSE Don't change the page.
  725. // TRUE Change the page.
  726. //
  727. //--
  728. /////////////////////////////////////////////////////////////////////////////
  729. BOOL CBasePropertyPage::OnWizardFinish( void )
  730. {
  731. ASSERT( BWizard() );
  732. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  733. CWaitCursor _wc;
  734. // BUG! There should be no need to call UpdateData in this function.
  735. // See BUG: Finish Button Fails Data Transfer from Page to Variables
  736. // KB Article ID: Q150349
  737. // Update the data in the class from the page.
  738. if ( ! UpdateData( TRUE /*bSaveAndValidate*/ ) )
  739. {
  740. return FALSE;
  741. } // if: error updating data
  742. // Save the data in the sheet.
  743. if ( ! BApplyChanges() )
  744. {
  745. return FALSE;
  746. } // if: error applying changes
  747. return CPropertyPage::OnWizardFinish();
  748. } //*** CBasePropertyPage::OnWizardFinish()
  749. /////////////////////////////////////////////////////////////////////////////
  750. //++
  751. //
  752. // CBasePropertyPage::OnChangeCtrl
  753. //
  754. // Description:
  755. // Handler for the messages sent when a control is changed. This
  756. // method can be specified in a message map if all that needs to be
  757. // done is enable the Apply button.
  758. //
  759. // Arguments:
  760. // None.
  761. //
  762. // Return Value:
  763. // None.
  764. //
  765. //--
  766. /////////////////////////////////////////////////////////////////////////////
  767. void CBasePropertyPage::OnChangeCtrl( void )
  768. {
  769. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  770. SetModified( TRUE );
  771. } //*** CBasePropertyPage::OnChangeCtrl()
  772. /////////////////////////////////////////////////////////////////////////////
  773. //++
  774. //
  775. // CBasePropertyPage::EnableNext
  776. //
  777. // Description:
  778. // Enables or disables the NEXT or FINISH button.
  779. //
  780. // Arguments:
  781. // bEnable [IN] TRUE = enable the button, FALSE = disable the button.
  782. //
  783. // Return Value:
  784. // None.
  785. //
  786. //--
  787. /////////////////////////////////////////////////////////////////////////////
  788. void CBasePropertyPage::EnableNext( IN BOOL bEnable /*TRUE*/ )
  789. {
  790. ASSERT( BWizard() );
  791. ASSERT( PiWizardCallback() );
  792. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  793. PiWizardCallback()->EnableNext( reinterpret_cast< LONG * >( Hpage() ), bEnable );
  794. } //*** CBasePropertyPage::EnableNext()
  795. /////////////////////////////////////////////////////////////////////////////
  796. //++
  797. //
  798. // CBasePropertyPage::BApplyChanges
  799. //
  800. // Description:
  801. // Apply changes made on the page.
  802. //
  803. // Arguments:
  804. // None.
  805. //
  806. // Return Value:
  807. // TRUE Page successfully applied.
  808. // FALSE Error applying page.
  809. //
  810. //--
  811. /////////////////////////////////////////////////////////////////////////////
  812. BOOL CBasePropertyPage::BApplyChanges( void )
  813. {
  814. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  815. CWaitCursor _wc;
  816. // Save data.
  817. return BSetPrivateProps();
  818. } //*** CBasePropertyPage::BApplyChanges()
  819. /////////////////////////////////////////////////////////////////////////////
  820. //++
  821. //
  822. // CBasePropertyPage::BBuildPropList
  823. //
  824. // Description:
  825. // Build the property list.
  826. //
  827. // Arguments:
  828. // rcpl [IN OUT] Cluster property list.
  829. // bNoNewProps [IN] TRUE = exclude properties marked with opfNew.
  830. //
  831. // Return Value:
  832. // TRUE Property list built successfully.
  833. // FALSE Error building property list.
  834. //
  835. // Exceptions Thrown:
  836. // Any exceptions thrown by CClusPropList::AddProp().
  837. //
  838. //--
  839. /////////////////////////////////////////////////////////////////////////////
  840. BOOL CBasePropertyPage::BBuildPropList(
  841. IN OUT CClusPropList & rcpl,
  842. IN BOOL bNoNewProps // = FALSE
  843. )
  844. {
  845. BOOL _bNewPropsFound = FALSE;
  846. DWORD _cprop;
  847. const CObjectProperty * _pprop;
  848. for ( _pprop = Pprops(), _cprop = Cprops() ; _cprop > 0 ; _pprop++, _cprop-- )
  849. {
  850. if ( bNoNewProps && (_pprop->m_fFlags & CObjectProperty::opfNew) )
  851. {
  852. _bNewPropsFound = TRUE;
  853. continue;
  854. } // if: no new props allowed and this is a new property
  855. switch ( _pprop->m_propFormat )
  856. {
  857. case CLUSPROP_FORMAT_SZ:
  858. rcpl.ScAddProp(
  859. _pprop->m_pwszName,
  860. *_pprop->m_value.pstr,
  861. *_pprop->m_valuePrev.pstr
  862. );
  863. break;
  864. case CLUSPROP_FORMAT_EXPAND_SZ:
  865. rcpl.ScAddExpandSzProp(
  866. _pprop->m_pwszName,
  867. *_pprop->m_value.pstr,
  868. *_pprop->m_valuePrev.pstr
  869. );
  870. break;
  871. case CLUSPROP_FORMAT_DWORD:
  872. rcpl.ScAddProp(
  873. _pprop->m_pwszName,
  874. *_pprop->m_value.pdw,
  875. *_pprop->m_valuePrev.pdw
  876. );
  877. break;
  878. case CLUSPROP_FORMAT_LONG:
  879. rcpl.ScAddProp(
  880. _pprop->m_pwszName,
  881. *_pprop->m_value.pl,
  882. *_pprop->m_valuePrev.pl
  883. );
  884. break;
  885. case CLUSPROP_FORMAT_BINARY:
  886. case CLUSPROP_FORMAT_MULTI_SZ:
  887. rcpl.ScAddProp(
  888. _pprop->m_pwszName,
  889. *_pprop->m_value.ppb,
  890. *_pprop->m_value.pcb,
  891. *_pprop->m_valuePrev.ppb,
  892. *_pprop->m_valuePrev.pcb
  893. );
  894. break;
  895. default:
  896. ASSERT( 0 ); // don't know how to deal with this type
  897. return FALSE;
  898. } // switch: property format
  899. } // for: each property
  900. return ( ! bNoNewProps || _bNewPropsFound );
  901. } //*** CBasePropertyPage::BBuildPropList()
  902. /////////////////////////////////////////////////////////////////////////////
  903. //++
  904. //
  905. // CBasePropertyPage::BSetPrivateProps
  906. //
  907. // Description:
  908. // Set the private properties for this object.
  909. //
  910. // Arguments:
  911. // bValidateOnly [IN] TRUE = only validate the data.
  912. // bNoNewProps [IN] TRUE = exclude properties marked with opfNew.
  913. //
  914. // Return Value:
  915. // ERROR_SUCCESS The operation was completed successfully.
  916. // !0 Failure.
  917. //
  918. //--
  919. /////////////////////////////////////////////////////////////////////////////
  920. BOOL CBasePropertyPage::BSetPrivateProps(
  921. IN BOOL bValidateOnly, // = FALSE
  922. IN BOOL bNoNewProps // = FALSE
  923. )
  924. {
  925. BOOL _bSuccess = TRUE;
  926. CClusPropList _cpl( BWizard() /*bAlwaysAddProp*/ );
  927. ASSERT( Peo() != NULL );
  928. ASSERT( Peo()->PrdResData() );
  929. ASSERT( Peo()->PrdResData()->m_hresource );
  930. // Build the property list.
  931. try
  932. {
  933. _bSuccess = BBuildPropList( _cpl, bNoNewProps );
  934. } // try
  935. catch ( CException * pe )
  936. {
  937. pe->ReportError();
  938. pe->Delete();
  939. _bSuccess = FALSE;
  940. } // catch: CException
  941. // Set the data.
  942. if ( _bSuccess )
  943. {
  944. if ( (_cpl.PbPropList() != NULL) && (_cpl.CbPropList() > 0) )
  945. {
  946. DWORD _sc = ERROR_SUCCESS;
  947. DWORD _dwControlCode;
  948. DWORD _cbProps;
  949. switch ( Cot() )
  950. {
  951. case CLUADMEX_OT_NODE:
  952. ASSERT( Peo()->PndNodeData() != NULL );
  953. ASSERT( Peo()->PndNodeData()->m_hnode != NULL );
  954. // Determine which control code to use.
  955. if ( bValidateOnly )
  956. {
  957. _dwControlCode = CLUSCTL_NODE_VALIDATE_PRIVATE_PROPERTIES;
  958. } // if: only validating data
  959. else
  960. {
  961. _dwControlCode = CLUSCTL_NODE_SET_PRIVATE_PROPERTIES;
  962. } // else: setting data
  963. // Set private properties.
  964. _sc = ClusterNodeControl(
  965. Peo()->PndNodeData()->m_hnode,
  966. NULL, // hNode
  967. _dwControlCode,
  968. _cpl.PbPropList(),
  969. _cpl.CbPropList(),
  970. NULL, // lpOutBuffer
  971. 0, // nOutBufferSize
  972. &_cbProps
  973. );
  974. break;
  975. case CLUADMEX_OT_GROUP:
  976. ASSERT( Peo()->PgdGroupData() != NULL );
  977. ASSERT( Peo()->PgdGroupData()->m_hgroup != NULL );
  978. // Determine which control code to use.
  979. if ( bValidateOnly )
  980. {
  981. _dwControlCode = CLUSCTL_GROUP_VALIDATE_PRIVATE_PROPERTIES;
  982. } // if: only validating data
  983. else
  984. {
  985. _dwControlCode = CLUSCTL_GROUP_SET_PRIVATE_PROPERTIES;
  986. } // else: setting data
  987. // Set private properties.
  988. _sc = ClusterGroupControl(
  989. Peo()->PgdGroupData()->m_hgroup,
  990. NULL, // hNode
  991. _dwControlCode,
  992. _cpl.PbPropList(),
  993. _cpl.CbPropList(),
  994. NULL, // lpOutBuffer
  995. 0, // nOutBufferSize
  996. &_cbProps
  997. );
  998. break;
  999. case CLUADMEX_OT_RESOURCE:
  1000. ASSERT( Peo()->PrdResData() != NULL );
  1001. ASSERT( Peo()->PrdResData()->m_hresource != NULL );
  1002. // Determine which control code to use.
  1003. if ( bValidateOnly )
  1004. {
  1005. _dwControlCode = CLUSCTL_RESOURCE_VALIDATE_PRIVATE_PROPERTIES;
  1006. } // if: only validating data
  1007. else
  1008. {
  1009. _dwControlCode = CLUSCTL_RESOURCE_SET_PRIVATE_PROPERTIES;
  1010. } // else: setting data
  1011. // Set private properties.
  1012. _sc = ClusterResourceControl(
  1013. Peo()->PrdResData()->m_hresource,
  1014. NULL, // hNode
  1015. _dwControlCode,
  1016. _cpl.PbPropList(),
  1017. _cpl.CbPropList(),
  1018. NULL, // lpOutBuffer
  1019. 0, // nOutBufferSize
  1020. &_cbProps
  1021. );
  1022. break;
  1023. case CLUADMEX_OT_RESOURCETYPE:
  1024. ASSERT( Peo()->PodObjData() != NULL );
  1025. ASSERT( Peo()->PodObjData()->m_strName.GetLength() > 0 );
  1026. // Determine which control code to use.
  1027. if ( bValidateOnly )
  1028. {
  1029. _dwControlCode = CLUSCTL_RESOURCE_TYPE_VALIDATE_PRIVATE_PROPERTIES;
  1030. } // if: only validating data
  1031. else
  1032. {
  1033. _dwControlCode = CLUSCTL_RESOURCE_TYPE_SET_PRIVATE_PROPERTIES;
  1034. } // else: setting data
  1035. // Set private properties.
  1036. _sc = ClusterResourceTypeControl(
  1037. Hcluster(),
  1038. Peo()->PodObjData()->m_strName,
  1039. NULL, // hNode
  1040. _dwControlCode,
  1041. _cpl.PbPropList(),
  1042. _cpl.CbPropList(),
  1043. NULL, // lpOutBuffer
  1044. 0, // nOutBufferSize
  1045. &_cbProps
  1046. );
  1047. break;
  1048. case CLUADMEX_OT_NETWORK:
  1049. ASSERT( Peo()->PndNetworkData() != NULL );
  1050. ASSERT( Peo()->PndNetworkData()->m_hnetwork != NULL );
  1051. // Determine which control code to use.
  1052. if ( bValidateOnly )
  1053. {
  1054. _dwControlCode = CLUSCTL_NETWORK_VALIDATE_PRIVATE_PROPERTIES;
  1055. } // if: only validating data
  1056. else
  1057. {
  1058. _dwControlCode = CLUSCTL_NETWORK_SET_PRIVATE_PROPERTIES;
  1059. } // else: setting data
  1060. // Set private properties.
  1061. _sc = ClusterNetworkControl(
  1062. Peo()->PndNetworkData()->m_hnetwork,
  1063. NULL, // hNode
  1064. _dwControlCode,
  1065. _cpl.PbPropList(),
  1066. _cpl.CbPropList(),
  1067. NULL, // lpOutBuffer
  1068. 0, // nOutBufferSize
  1069. &_cbProps
  1070. );
  1071. break;
  1072. case CLUADMEX_OT_NETINTERFACE:
  1073. ASSERT( Peo()->PndNetInterfaceData() != NULL );
  1074. ASSERT( Peo()->PndNetInterfaceData()->m_hnetinterface != NULL );
  1075. // Determine which control code to use.
  1076. if ( bValidateOnly )
  1077. {
  1078. _dwControlCode = CLUSCTL_NETINTERFACE_VALIDATE_PRIVATE_PROPERTIES;
  1079. } // if: only validating data
  1080. else
  1081. {
  1082. _dwControlCode = CLUSCTL_NETINTERFACE_SET_PRIVATE_PROPERTIES;
  1083. } // else: setting data
  1084. // Set private properties.
  1085. _sc = ClusterNetInterfaceControl(
  1086. Peo()->PndNetInterfaceData()->m_hnetinterface,
  1087. NULL, // hNode
  1088. _dwControlCode,
  1089. _cpl.PbPropList(),
  1090. _cpl.CbPropList(),
  1091. NULL, // lpOutBuffer
  1092. 0, // nOutBufferSize
  1093. &_cbProps
  1094. );
  1095. break;
  1096. default:
  1097. ASSERT( 0 );
  1098. } // switch: object type
  1099. // Handle errors.
  1100. if ( _sc != ERROR_SUCCESS )
  1101. {
  1102. if ( _sc == ERROR_INVALID_PARAMETER )
  1103. {
  1104. if ( ! bNoNewProps )
  1105. {
  1106. _bSuccess = BSetPrivateProps( bValidateOnly, TRUE /*bNoNewProps*/ );
  1107. } // if: new props are allowed
  1108. else
  1109. _bSuccess = FALSE;
  1110. } // if: invalid parameter error occurred
  1111. else if ( bValidateOnly
  1112. || (_sc != ERROR_RESOURCE_PROPERTIES_STORED) )
  1113. {
  1114. _bSuccess = FALSE;
  1115. } // else if: only validating and error other than properties only stored
  1116. //
  1117. // If an error occurred, display an error message.
  1118. //
  1119. if ( ! _bSuccess )
  1120. {
  1121. DisplaySetPropsError( _sc, bValidateOnly ? IDS_ERROR_VALIDATING_PROPERTIES : IDS_ERROR_SETTING_PROPERTIES );
  1122. } // if: error occurred
  1123. } // if: error setting/validating data
  1124. } // if: there is data to set
  1125. } // if: no errors building the property list
  1126. // Save data locally.
  1127. if ( ! bValidateOnly && _bSuccess )
  1128. {
  1129. // Save new values as previous values.
  1130. try
  1131. {
  1132. DWORD _cprop;
  1133. const CObjectProperty * _pprop;
  1134. for ( _pprop = Pprops(), _cprop = Cprops() ; _cprop > 0 ; _pprop++, _cprop-- )
  1135. {
  1136. switch ( _pprop->m_propFormat )
  1137. {
  1138. case CLUSPROP_FORMAT_SZ:
  1139. case CLUSPROP_FORMAT_EXPAND_SZ:
  1140. ASSERT(_pprop->m_value.pstr != NULL);
  1141. ASSERT(_pprop->m_valuePrev.pstr != NULL);
  1142. *_pprop->m_valuePrev.pstr = *_pprop->m_value.pstr;
  1143. break;
  1144. case CLUSPROP_FORMAT_DWORD:
  1145. case CLUSPROP_FORMAT_LONG:
  1146. ASSERT( _pprop->m_value.pdw != NULL );
  1147. ASSERT( _pprop->m_valuePrev.pdw != NULL );
  1148. *_pprop->m_valuePrev.pdw = *_pprop->m_value.pdw;
  1149. break;
  1150. case CLUSPROP_FORMAT_BINARY:
  1151. case CLUSPROP_FORMAT_MULTI_SZ:
  1152. ASSERT( _pprop->m_value.ppb != NULL );
  1153. ASSERT( *_pprop->m_value.ppb != NULL );
  1154. ASSERT( _pprop->m_value.pcb != NULL );
  1155. ASSERT( _pprop->m_valuePrev.ppb != NULL );
  1156. ASSERT( *_pprop->m_valuePrev.ppb != NULL );
  1157. ASSERT( _pprop->m_valuePrev.pcb != NULL );
  1158. delete [] *_pprop->m_valuePrev.ppb;
  1159. *_pprop->m_valuePrev.ppb = new BYTE[ *_pprop->m_value.pcb ];
  1160. CopyMemory( *_pprop->m_valuePrev.ppb, *_pprop->m_value.ppb, *_pprop->m_value.pcb );
  1161. *_pprop->m_valuePrev.pcb = *_pprop->m_value.pcb;
  1162. break;
  1163. default:
  1164. ASSERT( 0 ); // don't know how to deal with this type
  1165. } // switch: property format
  1166. } // for: each property
  1167. } // try
  1168. catch ( CException * _pe )
  1169. {
  1170. _pe->ReportError();
  1171. _pe->Delete();
  1172. _bSuccess = FALSE;
  1173. } // catch: CException
  1174. } // if: not just validating and successful so far
  1175. //
  1176. // Indicate we successfully saved the properties.
  1177. //
  1178. if ( ! bValidateOnly && _bSuccess )
  1179. {
  1180. m_bSaved = TRUE;
  1181. } // if: successfully saved data
  1182. return _bSuccess;
  1183. } //*** CBasePropertyPage::BSetPrivateProps()
  1184. /////////////////////////////////////////////////////////////////////////////
  1185. //++
  1186. //
  1187. // CBasePropertyPage::DisplaySetPropsError
  1188. //
  1189. // Routine Description:
  1190. // Display an error caused by setting or validating properties.
  1191. //
  1192. // Arguments:
  1193. // sc [IN] Status to display error on.
  1194. // idsOper [IN] Operation message.
  1195. //
  1196. // Return Value:
  1197. // nStatus ERROR_SUCCESS = success, !0 = failure
  1198. //
  1199. //--
  1200. /////////////////////////////////////////////////////////////////////////////
  1201. void CBasePropertyPage::DisplaySetPropsError(
  1202. IN DWORD sc,
  1203. IN UINT idsOper
  1204. ) const
  1205. {
  1206. CString _strErrorMsg;
  1207. CString _strOperMsg;
  1208. CString _strMsgIdFmt;
  1209. CString _strMsgId;
  1210. CString _strMsg;
  1211. _strOperMsg.LoadString( IDS_ERROR_SETTING_PROPERTIES );
  1212. FormatError( _strErrorMsg, sc );
  1213. _strMsgIdFmt.LoadString( IDS_ERROR_MSG_ID );
  1214. _strMsgId.Format( _strMsgIdFmt, sc, sc );
  1215. _strMsg.Format( _T("%s\n\n%s%s"), _strOperMsg, _strErrorMsg, _strMsgId );
  1216. AfxMessageBox( _strMsg );
  1217. } //*** CBasePropertyPage::DisplaySetPropsError()
  1218. /////////////////////////////////////////////////////////////////////////////
  1219. //++
  1220. //
  1221. // CBasePropertyPage::OnContextMenu
  1222. //
  1223. // Routine Description:
  1224. // Handler for the WM_CONTEXTMENU message.
  1225. //
  1226. // Arguments:
  1227. // pWnd Window in which user clicked the right mouse button.
  1228. // point Position of the cursor, in screen coordinates.
  1229. //
  1230. // Return Value:
  1231. // TRUE Help processed.
  1232. // FALSE Help not processed.
  1233. //
  1234. //--
  1235. /////////////////////////////////////////////////////////////////////////////
  1236. void CBasePropertyPage::OnContextMenu( CWnd * pWnd, CPoint point )
  1237. {
  1238. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  1239. m_dlghelp.OnContextMenu( pWnd, point );
  1240. } //*** CBasePropertyPage::OnContextMenu()
  1241. /////////////////////////////////////////////////////////////////////////////
  1242. //++
  1243. //
  1244. // CBasePropertyPage::OnHelpInfo
  1245. //
  1246. // Routine Description:
  1247. // Handler for the WM_HELPINFO message.
  1248. //
  1249. // Arguments:
  1250. // pHelpInfo Structure containing info about displaying help.
  1251. //
  1252. // Return Value:
  1253. // TRUE Help processed.
  1254. // FALSE Help not processed.
  1255. //
  1256. //--
  1257. /////////////////////////////////////////////////////////////////////////////
  1258. BOOL CBasePropertyPage::OnHelpInfo( HELPINFO * pHelpInfo )
  1259. {
  1260. BOOL _bProcessed;
  1261. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  1262. _bProcessed = m_dlghelp.OnHelpInfo( pHelpInfo );
  1263. if ( ! _bProcessed )
  1264. {
  1265. _bProcessed = CPropertyPage::OnHelpInfo( pHelpInfo );
  1266. } // if: message not processed yet
  1267. return _bProcessed;
  1268. } //*** CBasePropertyPage::OnHelpInfo()
  1269. /////////////////////////////////////////////////////////////////////////////
  1270. //++
  1271. //
  1272. // CBasePropertyPage::OnCommandHelp
  1273. //
  1274. // Routine Description:
  1275. // Handler for the WM_COMMANDHELP message.
  1276. //
  1277. // Arguments:
  1278. // wParam [IN] WPARAM.
  1279. // lParam [IN] LPARAM.
  1280. //
  1281. // Return Value:
  1282. // TRUE Help processed.
  1283. // FALSE Help not processed.
  1284. //
  1285. //--
  1286. /////////////////////////////////////////////////////////////////////////////
  1287. LRESULT CBasePropertyPage::OnCommandHelp( WPARAM wParam, LPARAM lParam )
  1288. {
  1289. LRESULT _bProcessed;
  1290. AFX_MANAGE_STATE( AfxGetStaticModuleState() );
  1291. _bProcessed = m_dlghelp.OnCommandHelp( wParam, lParam );
  1292. if ( ! _bProcessed )
  1293. {
  1294. _bProcessed = CPropertyPage::OnCommandHelp( wParam, lParam );
  1295. } // if: message not processed yet
  1296. return _bProcessed;
  1297. } //*** CBasePropertyPage::OnCommandHelp()