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.

1425 lines
34 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. mscopewiz.cpp
  7. DHCP multicast scope creation dialog
  8. FILE HISTORY:
  9. */
  10. #include "stdafx.h"
  11. #include "server.h"
  12. #include "mscope.h"
  13. #include "mscopwiz.h"
  14. #ifdef _DEBUG
  15. #define new DEBUG_NEW
  16. #undef THIS_FILE
  17. static char THIS_FILE[] = __FILE__;
  18. #endif
  19. #define HOURS_MAX 23
  20. #define MINUTES_MAX 59
  21. int CMScopeWizLeaseTime::m_nDaysDefault = MSCOPE_DFAULT_LEASE_DAYS;
  22. int CMScopeWizLeaseTime::m_nHoursDefault = MSCOPE_DFAULT_LEASE_HOURS;
  23. int CMScopeWizLeaseTime::m_nMinutesDefault = MSCOPE_DFAULT_LEASE_MINUTES;
  24. /////////////////////////////////////////////////////////////////////////////
  25. //
  26. // CMScopeWiz holder
  27. //
  28. /////////////////////////////////////////////////////////////////////////////
  29. CMScopeWiz::CMScopeWiz
  30. (
  31. ITFSNode * pNode,
  32. IComponentData * pComponentData,
  33. ITFSComponentData * pTFSCompData,
  34. LPCTSTR pszSheetName
  35. ) : CPropertyPageHolderBase(pNode, pComponentData, pszSheetName)
  36. {
  37. //ASSERT(pFolderNode == GetContainerNode());
  38. m_bAutoDeletePages = FALSE; // we have the pages as embedded members
  39. AddPageToList((CPropertyPageBase*) &m_pageWelcome);
  40. AddPageToList((CPropertyPageBase*) &m_pageName);
  41. AddPageToList((CPropertyPageBase*) &m_pageInvalidName);
  42. AddPageToList((CPropertyPageBase*) &m_pageSetRange);
  43. AddPageToList((CPropertyPageBase*) &m_pageSetExclusions);
  44. AddPageToList((CPropertyPageBase*) &m_pageLeaseTime);
  45. AddPageToList((CPropertyPageBase*) &m_pageActivate);
  46. AddPageToList((CPropertyPageBase*) &m_pageFinished);
  47. Assert(pTFSCompData != NULL);
  48. m_spTFSCompData.Set(pTFSCompData);
  49. m_bWiz97 = TRUE;
  50. m_spTFSCompData->SetWatermarkInfo(&g_WatermarkInfoScope);
  51. }
  52. CMScopeWiz::~CMScopeWiz()
  53. {
  54. RemovePageFromList((CPropertyPageBase*) &m_pageName, FALSE);
  55. RemovePageFromList((CPropertyPageBase*) &m_pageInvalidName, FALSE);
  56. RemovePageFromList((CPropertyPageBase*) &m_pageSetRange, FALSE);
  57. RemovePageFromList((CPropertyPageBase*) &m_pageSetExclusions, FALSE);
  58. RemovePageFromList((CPropertyPageBase*) &m_pageLeaseTime, FALSE);
  59. RemovePageFromList((CPropertyPageBase*) &m_pageActivate, FALSE);
  60. RemovePageFromList((CPropertyPageBase*) &m_pageFinished, FALSE);
  61. }
  62. //
  63. // Called from the OnWizardFinish to add the DHCP Server to the list
  64. //
  65. DWORD
  66. CMScopeWiz::OnFinish()
  67. {
  68. return CreateScope();
  69. }
  70. BOOL
  71. CMScopeWiz::GetScopeRange(CDhcpIpRange * pdhcpIpRange)
  72. {
  73. return m_pageSetRange.GetScopeRange(pdhcpIpRange);
  74. }
  75. DWORD
  76. CMScopeWiz::CreateScope()
  77. {
  78. LONG err = 0,
  79. err2 ;
  80. BOOL fScopeCreated = FALSE;
  81. CString strLangTag;
  82. CDhcpMScope * pobScope = NULL ;
  83. CDhcpIpRange dhcpIpRange;
  84. CDhcpServer * pServer;
  85. SPITFSNode spNode, spServerNode;
  86. spServerNode = GetNode();
  87. do
  88. {
  89. m_pageSetRange.GetScopeRange(&dhcpIpRange);
  90. pServer = GETHANDLER(CDhcpServer, spServerNode);
  91. //
  92. // Create the scope on the server and then we can
  93. // create our internal object.
  94. //
  95. DHCP_MSCOPE_INFO MScopeInfo = {0};
  96. MScopeInfo.MScopeName = (LPWSTR) ((LPCTSTR) m_pageName.m_strName);
  97. MScopeInfo.MScopeComment = (LPWSTR) ((LPCTSTR) m_pageName.m_strComment);
  98. // scope ID is the starting address of the madcap scope
  99. MScopeInfo.MScopeId = dhcpIpRange.QueryAddr(TRUE);
  100. MScopeInfo.MScopeAddressPolicy = 0;
  101. MScopeInfo.MScopeState = (m_pageActivate.m_fActivate) ? DhcpSubnetEnabled : DhcpSubnetDisabled;
  102. MScopeInfo.MScopeFlags = 0;
  103. // TBD: there is a DCR to be able to set this value.
  104. // set to infinite for now
  105. MScopeInfo.ExpiryTime.dwLowDateTime = DHCP_DATE_TIME_INFINIT_LOW;
  106. MScopeInfo.ExpiryTime.dwHighDateTime = DHCP_DATE_TIME_INFINIT_HIGH;
  107. MScopeInfo.TTL = m_pageSetRange.GetTTL();
  108. err = pServer->CreateMScope(&MScopeInfo);
  109. if (err != 0)
  110. {
  111. Trace1("CMScopeWiz::CreateScope() - Couldn't create scope! Error = %d\n", err);
  112. break;
  113. }
  114. SPITFSComponentData spTFSCompData;
  115. spTFSCompData = GetTFSCompData();
  116. pobScope = new CDhcpMScope(spTFSCompData);
  117. if ( pobScope == NULL )
  118. {
  119. err = ERROR_NOT_ENOUGH_MEMORY ;
  120. break ;
  121. }
  122. SPITFSNodeMgr spNodeMgr;
  123. spServerNode->GetNodeMgr(&spNodeMgr);
  124. //
  125. // Store the server object in the holder
  126. //
  127. CreateContainerTFSNode(&spNode,
  128. &GUID_DhcpServerNodeType,
  129. pobScope,
  130. pobScope,
  131. spNodeMgr);
  132. // Tell the handler to initialize any specific data
  133. pobScope->SetServer(spServerNode);
  134. pobScope->InitMScopeInfo(&MScopeInfo);
  135. pobScope->InitializeNode((ITFSNode *) spNode);
  136. pServer = GETHANDLER(CDhcpServer, spServerNode);
  137. pServer->AddMScopeSorted(spServerNode, spNode);
  138. pobScope->Release();
  139. fScopeCreated = TRUE;
  140. //
  141. // Finish updating the scope. First, the IP address range
  142. // from which to allocate addresses.
  143. //
  144. if ( err = pobScope->SetIpRange( dhcpIpRange, TRUE ) )
  145. {
  146. Trace1("SetIpRange failed!! %d\n", err);
  147. break ;
  148. }
  149. //
  150. // Next, see if any exclusions were specified.
  151. //
  152. err = pobScope->StoreExceptionList( m_pageSetExclusions.GetExclusionList() ) ;
  153. if (err != ERROR_SUCCESS)
  154. {
  155. Trace1("StoreExceptionList failed!! %d\n", err);
  156. break;
  157. }
  158. //
  159. // set the lease time
  160. //
  161. DWORD dwLeaseTime;
  162. dwLeaseTime = m_pageLeaseTime.GetLeaseTime();
  163. err = pobScope->SetLeaseTime(dwLeaseTime);
  164. if (err != ERROR_SUCCESS)
  165. {
  166. Trace1("SetLeaseTime failed!! %d\n", err);
  167. break;
  168. }
  169. }
  170. while ( FALSE ) ;
  171. if ( err )
  172. {
  173. //
  174. // CODEWORK:: The scope should never have been added
  175. // to the remote registry in the first place.
  176. //
  177. if (pobScope != NULL)
  178. {
  179. if (fScopeCreated)
  180. {
  181. Trace0("Bad scope nevertheless was created\n");
  182. err2 = pServer->DeleteMSubnet(pobScope->GetName());
  183. if (err2 != ERROR_SUCCESS)
  184. {
  185. Trace1("Couldn't remove the bad scope! Error = %d\n", err2);
  186. }
  187. }
  188. spServerNode->RemoveChild(spNode);
  189. }
  190. }
  191. return err;
  192. }
  193. /////////////////////////////////////////////////////////////////////////////
  194. //
  195. // CMScopeWizName property page
  196. //
  197. /////////////////////////////////////////////////////////////////////////////
  198. IMPLEMENT_DYNCREATE(CMScopeWizName, CPropertyPageBase)
  199. CMScopeWizName::CMScopeWizName() : CPropertyPageBase(CMScopeWizName::IDD)
  200. {
  201. //{{AFX_DATA_INIT(CMScopeWizName)
  202. m_strName = _T("");
  203. m_strComment = _T("");
  204. //}}AFX_DATA_INIT
  205. InitWiz97(FALSE, IDS_MSCOPE_WIZ_NAME_TITLE, IDS_MSCOPE_WIZ_NAME_SUBTITLE);
  206. }
  207. CMScopeWizName::~CMScopeWizName()
  208. {
  209. }
  210. void CMScopeWizName::DoDataExchange(CDataExchange* pDX)
  211. {
  212. CPropertyPageBase::DoDataExchange(pDX);
  213. //{{AFX_DATA_MAP(CMScopeWizName)
  214. DDX_Control(pDX, IDC_EDIT_SCOPE_NAME, m_editScopeName);
  215. DDX_Control(pDX, IDC_EDIT_SCOPE_COMMENT, m_editScopeComment);
  216. DDX_Text(pDX, IDC_EDIT_SCOPE_NAME, m_strName);
  217. DDX_Text(pDX, IDC_EDIT_SCOPE_COMMENT, m_strComment);
  218. //}}AFX_DATA_MAP
  219. }
  220. BEGIN_MESSAGE_MAP(CMScopeWizName, CPropertyPageBase)
  221. //{{AFX_MSG_MAP(CMScopeWizName)
  222. ON_EN_CHANGE(IDC_EDIT_SCOPE_NAME, OnChangeEditScopeName)
  223. //}}AFX_MSG_MAP
  224. END_MESSAGE_MAP()
  225. /////////////////////////////////////////////////////////////////////////////
  226. //
  227. // CMScopeWizName message handlers
  228. //
  229. /////////////////////////////////////////////////////////////////////////////
  230. BOOL CMScopeWizName::OnInitDialog()
  231. {
  232. CPropertyPageBase::OnInitDialog();
  233. return TRUE; // return TRUE unless you set the focus to a control
  234. // EXCEPTION: OCX Property Pages should return FALSE
  235. }
  236. LRESULT CMScopeWizName::OnWizardNext()
  237. {
  238. UpdateData();
  239. return IDW_MSCOPE_SET_SCOPE;
  240. }
  241. BOOL CMScopeWizName::OnSetActive()
  242. {
  243. UpdateButtons();
  244. return CPropertyPageBase::OnSetActive();
  245. }
  246. void CMScopeWizName::OnChangeEditScopeName()
  247. {
  248. UpdateButtons();
  249. }
  250. /////////////////////////////////////////////////////////////////////////////
  251. //
  252. // CMScopeWizName implementation specific
  253. //
  254. /////////////////////////////////////////////////////////////////////////////
  255. void
  256. CMScopeWizName::UpdateButtons()
  257. {
  258. BOOL bValid = FALSE;
  259. UpdateData();
  260. if (m_strName.GetLength() > 0)
  261. bValid = TRUE;
  262. GetHolder()->SetWizardButtonsMiddle(bValid);
  263. }
  264. /////////////////////////////////////////////////////////////////////////////
  265. //
  266. // CMScopeWizInvalidName property page
  267. //
  268. /////////////////////////////////////////////////////////////////////////////
  269. IMPLEMENT_DYNCREATE(CMScopeWizInvalidName, CPropertyPageBase)
  270. CMScopeWizInvalidName::CMScopeWizInvalidName() : CPropertyPageBase(CMScopeWizInvalidName::IDD)
  271. {
  272. //{{AFX_DATA_INIT(CMScopeWizInvalidName)
  273. // NOTE: the ClassWizard will add member initialization here
  274. //}}AFX_DATA_INIT
  275. InitWiz97(FALSE, IDS_MSCOPE_WIZ_INVALID_NAME_TITLE, IDS_MSCOPE_WIZ_INVALID_NAME_SUBTITLE);
  276. }
  277. CMScopeWizInvalidName::~CMScopeWizInvalidName()
  278. {
  279. }
  280. void CMScopeWizInvalidName::DoDataExchange(CDataExchange* pDX)
  281. {
  282. CPropertyPageBase::DoDataExchange(pDX);
  283. //{{AFX_DATA_MAP(CMScopeWizInvalidName)
  284. // NOTE: the ClassWizard will add DDX and DDV calls here
  285. //}}AFX_DATA_MAP
  286. }
  287. BEGIN_MESSAGE_MAP(CMScopeWizInvalidName, CPropertyPageBase)
  288. //{{AFX_MSG_MAP(CMScopeWizInvalidName)
  289. // NOTE: the ClassWizard will add message map macros here
  290. //}}AFX_MSG_MAP
  291. END_MESSAGE_MAP()
  292. /////////////////////////////////////////////////////////////////////////////
  293. //
  294. // CMScopeWizInvalidName message handlers
  295. //
  296. /////////////////////////////////////////////////////////////////////////////
  297. BOOL CMScopeWizInvalidName::OnInitDialog()
  298. {
  299. CPropertyPageBase::OnInitDialog();
  300. return TRUE; // return TRUE unless you set the focus to a control
  301. // EXCEPTION: OCX Property Pages should return FALSE
  302. }
  303. LRESULT CMScopeWizInvalidName::OnWizardBack()
  304. {
  305. // TODO: Add your specialized code here and/or call the base class
  306. return IDW_MSCOPE_NAME;
  307. }
  308. BOOL CMScopeWizInvalidName::OnSetActive()
  309. {
  310. GetHolder()->SetWizardButtonsLast(FALSE);
  311. return CPropertyPageBase::OnSetActive();
  312. }
  313. /////////////////////////////////////////////////////////////////////////////
  314. //
  315. // CMScopeWizSetRange property page
  316. //
  317. /////////////////////////////////////////////////////////////////////////////
  318. IMPLEMENT_DYNCREATE(CMScopeWizSetRange, CPropertyPageBase)
  319. CMScopeWizSetRange::CMScopeWizSetRange() : CPropertyPageBase(CMScopeWizSetRange::IDD)
  320. {
  321. //{{AFX_DATA_INIT(CMScopeWizSetRange)
  322. //}}AFX_DATA_INIT
  323. InitWiz97(FALSE, IDS_MSCOPE_WIZ_SCOPE_TITLE, IDS_MSCOPE_WIZ_SCOPE_SUBTITLE);
  324. }
  325. CMScopeWizSetRange::~CMScopeWizSetRange()
  326. {
  327. }
  328. void CMScopeWizSetRange::DoDataExchange(CDataExchange* pDX)
  329. {
  330. CPropertyPageBase::DoDataExchange(pDX);
  331. //{{AFX_DATA_MAP(CMScopeWizSetRange)
  332. DDX_Control(pDX, IDC_SPIN_TTL, m_spinTTL);
  333. DDX_Control(pDX, IDC_EDIT_TTL, m_editTTL);
  334. //}}AFX_DATA_MAP
  335. DDX_Control(pDX, IDC_IPADDR_POOL_START, m_ipaStart);
  336. DDX_Control(pDX, IDC_IPADDR_POOL_STOP, m_ipaEnd);
  337. }
  338. BEGIN_MESSAGE_MAP(CMScopeWizSetRange, CPropertyPageBase)
  339. //{{AFX_MSG_MAP(CMScopeWizSetRange)
  340. ON_EN_KILLFOCUS(IDC_IPADDR_POOL_START, OnKillfocusPoolStart)
  341. ON_EN_KILLFOCUS(IDC_IPADDR_POOL_STOP, OnKillfocusPoolStop)
  342. ON_EN_CHANGE(IDC_EDIT_MASK_LENGTH, OnChangeEditMaskLength)
  343. ON_EN_CHANGE(IDC_IPADDR_POOL_START, OnChangePoolStart)
  344. ON_EN_CHANGE(IDC_IPADDR_POOL_STOP, OnChangePoolStop)
  345. //}}AFX_MSG_MAP
  346. END_MESSAGE_MAP()
  347. /////////////////////////////////////////////////////////////////////////////
  348. //
  349. // CMScopeWizSetRange message handlers
  350. //
  351. /////////////////////////////////////////////////////////////////////////////
  352. BOOL CMScopeWizSetRange::OnInitDialog()
  353. {
  354. CPropertyPageBase::OnInitDialog();
  355. m_spinTTL.SetRange(1, 255);
  356. m_spinTTL.SetPos(32);
  357. return TRUE; // return TRUE unless you set the focus to a control
  358. // EXCEPTION: OCX Property Pages should return FALSE
  359. }
  360. LRESULT CMScopeWizSetRange::OnWizardNext()
  361. {
  362. UpdateData();
  363. CDhcpIpRange rangeMScope, rangeMulticast;
  364. rangeMulticast.SetAddr(MCAST_ADDRESS_MIN, TRUE);
  365. rangeMulticast.SetAddr(MCAST_ADDRESS_MAX, FALSE);
  366. // check the TTL
  367. int nTTL = m_spinTTL.GetPos();
  368. if ( (nTTL < 1) ||
  369. (nTTL > 255) )
  370. {
  371. // invalid TTL specified
  372. AfxMessageBox(IDS_INVALID_TTL);
  373. m_editTTL.SetFocus();
  374. m_editTTL.SetSel(0,-1);
  375. return -1;
  376. }
  377. // valid address range?
  378. GetScopeRange(&rangeMScope);
  379. if (rangeMScope.QueryAddr(TRUE) >= rangeMScope.QueryAddr(FALSE))
  380. {
  381. AfxMessageBox(IDS_ERR_IP_RANGE_INV_START);
  382. m_ipaStart.SetFocus();
  383. return -1;
  384. }
  385. if (!rangeMScope.IsSubset(rangeMulticast))
  386. {
  387. AfxMessageBox(IDS_INVALID_MCAST_ADDRESS);
  388. m_ipaStart.SetFocus();
  389. return -1;
  390. }
  391. // if the mcast scope range falls in the scoped area, make sure
  392. // the range is at least 256 addresses
  393. if (rangeMScope.QueryAddr(FALSE) > MCAST_SCOPED_RANGE_MIN)
  394. {
  395. if ( ((rangeMScope.QueryAddr(FALSE) - rangeMScope.QueryAddr(TRUE)) + 1) < 256)
  396. {
  397. AfxMessageBox(IDS_INVALID_MCAST_SCOPED_RANGE);
  398. m_ipaStart.SetFocus();
  399. return -1;
  400. }
  401. }
  402. // is the scope ID in use?
  403. SPITFSNode spServerNode;
  404. CDhcpServer * pServer;
  405. spServerNode = GetHolder()->GetNode();
  406. pServer = GETHANDLER(CDhcpServer, spServerNode);
  407. if (pServer->DoesMScopeExist(spServerNode, rangeMScope.QueryAddr(TRUE)))
  408. {
  409. AfxMessageBox(IDS_ERR_IP_RANGE_OVERLAP);
  410. return -1;
  411. }
  412. return IDW_MSCOPE_SET_EXCLUSIONS;
  413. }
  414. LRESULT CMScopeWizSetRange::OnWizardBack()
  415. {
  416. return IDW_MSCOPE_NAME;
  417. }
  418. BOOL CMScopeWizSetRange::OnSetActive()
  419. {
  420. m_fPageActive = TRUE;
  421. UpdateButtons();
  422. return CPropertyPageBase::OnSetActive();
  423. }
  424. BOOL CMScopeWizSetRange::OnKillActive()
  425. {
  426. m_fPageActive = FALSE;
  427. UpdateButtons();
  428. return CPropertyPageBase::OnKillActive();
  429. }
  430. void CMScopeWizSetRange::OnKillfocusPoolStart()
  431. {
  432. }
  433. void CMScopeWizSetRange::OnKillfocusPoolStop()
  434. {
  435. }
  436. void CMScopeWizSetRange::OnChangeEditMaskLength()
  437. {
  438. UpdateButtons();
  439. }
  440. void CMScopeWizSetRange::OnChangePoolStop()
  441. {
  442. UpdateButtons();
  443. }
  444. void CMScopeWizSetRange::OnChangePoolStart()
  445. {
  446. UpdateButtons();
  447. }
  448. /////////////////////////////////////////////////////////////////////////////
  449. //
  450. // CMScopeWizSetRange implementation specific
  451. //
  452. /////////////////////////////////////////////////////////////////////////////
  453. BOOL
  454. CMScopeWizSetRange::GetScopeRange(CDhcpIpRange * pdhcpIpRange)
  455. {
  456. DHCP_IP_RANGE dhcpIpRange;
  457. if ( !m_ipaStart.GetAddress( & dhcpIpRange.StartAddress ) )
  458. {
  459. return FALSE ;
  460. }
  461. if ( !m_ipaEnd.GetAddress( & dhcpIpRange.EndAddress ) )
  462. {
  463. return FALSE;
  464. }
  465. *pdhcpIpRange = dhcpIpRange;
  466. return TRUE;
  467. }
  468. BYTE
  469. CMScopeWizSetRange::GetTTL()
  470. {
  471. BYTE TTL;
  472. TTL = (LOBYTE(LOWORD(m_spinTTL.GetPos())));
  473. return TTL;
  474. }
  475. void
  476. CMScopeWizSetRange::UpdateButtons()
  477. {
  478. DWORD lStart, lEnd;
  479. m_ipaStart.GetAddress(&lStart);
  480. m_ipaEnd.GetAddress(&lEnd);
  481. if (lStart && lEnd)
  482. GetHolder()->SetWizardButtonsMiddle(TRUE);
  483. else
  484. GetHolder()->SetWizardButtonsMiddle(FALSE);
  485. }
  486. /////////////////////////////////////////////////////////////////////////////
  487. //
  488. // CMScopeWizSetExclusions property page
  489. //
  490. /////////////////////////////////////////////////////////////////////////////
  491. IMPLEMENT_DYNCREATE(CMScopeWizSetExclusions, CPropertyPageBase)
  492. CMScopeWizSetExclusions::CMScopeWizSetExclusions() : CPropertyPageBase(CMScopeWizSetExclusions::IDD)
  493. {
  494. //{{AFX_DATA_INIT(CMScopeWizSetExclusions)
  495. //}}AFX_DATA_INIT
  496. InitWiz97(FALSE, IDS_MSCOPE_WIZ_EXCLUSIONS_TITLE, IDS_MSCOPE_WIZ_EXCLUSIONS_SUBTITLE);
  497. }
  498. CMScopeWizSetExclusions::~CMScopeWizSetExclusions()
  499. {
  500. while (m_listExclusions.GetCount())
  501. delete m_listExclusions.RemoveHead();
  502. }
  503. void CMScopeWizSetExclusions::DoDataExchange(CDataExchange* pDX)
  504. {
  505. CPropertyPageBase::DoDataExchange(pDX);
  506. //{{AFX_DATA_MAP(CMScopeWizSetExclusions)
  507. DDX_Control(pDX, IDC_LIST_EXCLUSION_RANGES, m_listboxExclusions);
  508. DDX_Control(pDX, IDC_BUTTON_EXCLUSION_DELETE, m_buttonExclusionDelete);
  509. DDX_Control(pDX, IDC_BUTTON_EXCLUSION_ADD, m_buttonExclusionAdd);
  510. //}}AFX_DATA_MAP
  511. //
  512. // IP Address custom controls
  513. //
  514. DDX_Control(pDX, IDC_IPADDR_EXCLUSION_START, m_ipaStart);
  515. DDX_Control(pDX, IDC_IPADDR_EXCLUSION_END, m_ipaEnd);
  516. }
  517. BEGIN_MESSAGE_MAP(CMScopeWizSetExclusions, CPropertyPageBase)
  518. //{{AFX_MSG_MAP(CMScopeWizSetExclusions)
  519. ON_BN_CLICKED(IDC_BUTTON_EXCLUSION_ADD, OnButtonExclusionAdd)
  520. ON_BN_CLICKED(IDC_BUTTON_EXCLUSION_DELETE, OnButtonExclusionDelete)
  521. //}}AFX_MSG_MAP
  522. ON_EN_CHANGE(IDC_IPADDR_EXCLUSION_START, OnChangeExclusionStart)
  523. ON_EN_CHANGE(IDC_IPADDR_EXCLUSION_END, OnChangeExclusionEnd)
  524. END_MESSAGE_MAP()
  525. /////////////////////////////////////////////////////////////////////////////
  526. //
  527. // CMScopeWizSetExclusions message handlers
  528. //
  529. /////////////////////////////////////////////////////////////////////////////
  530. BOOL CMScopeWizSetExclusions::OnInitDialog()
  531. {
  532. CPropertyPageBase::OnInitDialog();
  533. return TRUE; // return TRUE unless you set the focus to a control
  534. // EXCEPTION: OCX Property Pages should return FALSE
  535. }
  536. LRESULT CMScopeWizSetExclusions::OnWizardNext()
  537. {
  538. return IDW_MSCOPE_LEASE_TIME;
  539. }
  540. LRESULT CMScopeWizSetExclusions::OnWizardBack()
  541. {
  542. return IDW_MSCOPE_SET_SCOPE;
  543. }
  544. BOOL CMScopeWizSetExclusions::OnSetActive()
  545. {
  546. GetHolder()->SetWizardButtonsMiddle(TRUE);
  547. UpdateButtons();
  548. return CPropertyPageBase::OnSetActive();
  549. }
  550. void CMScopeWizSetExclusions::OnChangeExclusionStart()
  551. {
  552. UpdateButtons();
  553. }
  554. void CMScopeWizSetExclusions::OnChangeExclusionEnd()
  555. {
  556. UpdateButtons();
  557. }
  558. void CMScopeWizSetExclusions::OnButtonExclusionAdd()
  559. {
  560. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  561. DWORD err = 0;
  562. CDhcpIpRange dhcpExclusionRange;
  563. CDhcpIpRange dhcpScopeRange;
  564. ((CMScopeWiz *)GetHolder())->GetScopeRange(&dhcpScopeRange);
  565. //
  566. // Get the data into a range object.
  567. //
  568. if ( !GetExclusionRange(dhcpExclusionRange) )
  569. {
  570. err = IDS_ERR_IP_RANGE_INVALID ;
  571. }
  572. else if ( IsOverlappingRange( dhcpExclusionRange ) )
  573. {
  574. //
  575. // Walk the current list, determining if the new range is valid.
  576. // Then, if OK, verify that it's really a sub-range of the current range.
  577. //
  578. err = IDS_ERR_IP_RANGE_OVERLAP ;
  579. m_ipaStart.SetFocus();
  580. }
  581. else if ( ! dhcpExclusionRange.IsSubset( dhcpScopeRange ) )
  582. {
  583. //
  584. // Guarantee that the new range is an (improper) subset of the scope's range
  585. //
  586. err = IDS_ERR_IP_RANGE_NOT_SUBSET ;
  587. m_ipaStart.SetFocus();
  588. }
  589. if ( err == 0 )
  590. {
  591. //TRY
  592. {
  593. //
  594. // Create a new IP range object and add it to the current list
  595. //
  596. CDhcpIpRange * pIpRange = new CDhcpIpRange( dhcpExclusionRange ) ;
  597. m_listExclusions.AddTail(pIpRange);
  598. //
  599. // Refill the exclusions listbox including the new item.
  600. //
  601. Fill( (int) (m_listExclusions.GetCount() - 1) ) ;
  602. }
  603. //CATCH_ALL(e)
  604. //{
  605. // err = ERROR_NOT_ENOUGH_MEMORY ;
  606. //}
  607. //END_CATCH_ALL
  608. }
  609. if ( err )
  610. {
  611. ::DhcpMessageBox( err ) ;
  612. }
  613. else
  614. {
  615. //
  616. // Succesfully added the exlusion range, now blank out the
  617. // ip controls
  618. //
  619. m_ipaStart.ClearAddress();
  620. m_ipaEnd.ClearAddress();
  621. m_ipaStart.SetFocus();
  622. }
  623. }
  624. void CMScopeWizSetExclusions::OnButtonExclusionDelete()
  625. {
  626. //
  627. // Index into the listbox, delete the item from the active list
  628. // and move its data into the edit controls
  629. //
  630. int index = m_listboxExclusions.GetCurSel() ;
  631. ASSERT( index >= 0 ) ; // Button should not be enabled if no selection.
  632. if ( index < 0 )
  633. {
  634. return ;
  635. }
  636. POSITION pos = m_listExclusions.FindIndex(index);
  637. CDhcpIpRange * pdhcRange = (CDhcpIpRange *) m_listExclusions.GetAt(pos);
  638. m_listExclusions.RemoveAt(pos);
  639. ASSERT( pdhcRange != NULL ) ;
  640. //
  641. // Put the deleted range into the exclusions controls
  642. //
  643. FillExcl( pdhcRange ) ;
  644. //
  645. // Refill the list box and call HandleActivation()
  646. //
  647. if ( index >= m_listboxExclusions.GetCount() )
  648. {
  649. index-- ;
  650. }
  651. Fill( index ) ;
  652. m_ipaStart.SetFocus();
  653. UpdateButtons();
  654. }
  655. //
  656. // Format the IP range pair into the exclusion edit controls
  657. //
  658. void
  659. CMScopeWizSetExclusions::FillExcl
  660. (
  661. CDhcpIpRange * pdhcIpRange
  662. )
  663. {
  664. LONG lStart = pdhcIpRange->QueryAddr( TRUE );
  665. LONG lEnd = pdhcIpRange->QueryAddr( FALSE );
  666. m_ipaStart.SetAddress( lStart ) ;
  667. m_ipaStart.SetModify( TRUE ) ;
  668. m_ipaStart.Invalidate() ;
  669. //
  670. // If the ending address is the same as the starting address,
  671. // do not fill in the ending address.
  672. //
  673. if (lStart != lEnd)
  674. {
  675. m_ipaEnd.SetAddress( lEnd ) ;
  676. }
  677. else
  678. {
  679. m_ipaEnd.ClearAddress();
  680. }
  681. m_ipaEnd.SetModify( TRUE ) ;
  682. m_ipaEnd.Invalidate() ;
  683. }
  684. //
  685. // Convert the IP address range controls to a range.
  686. //
  687. BOOL
  688. CMScopeWizSetExclusions::GetExclusionRange
  689. (
  690. CDhcpIpRange & dhcIpRange
  691. )
  692. {
  693. DHCP_IP_RANGE dhipr ;
  694. if ( !m_ipaStart.GetAddress( & dhipr.StartAddress ) )
  695. {
  696. m_ipaStart.SetFocus();
  697. return FALSE ;
  698. }
  699. if ( !m_ipaEnd.GetAddress( & dhipr.EndAddress ) )
  700. {
  701. //
  702. // If no ending range was specified, assume a singular exlusion
  703. // (the starting address) was requested.
  704. //
  705. m_ipaEnd.SetFocus();
  706. dhipr.EndAddress = dhipr.StartAddress;
  707. }
  708. dhcIpRange = dhipr ;
  709. return (BOOL) dhcIpRange ;
  710. }
  711. BOOL
  712. CMScopeWizSetExclusions::IsOverlappingRange
  713. (
  714. CDhcpIpRange & dhcpIpRange
  715. )
  716. {
  717. POSITION pos;
  718. CDhcpIpRange * pdhcpRange ;
  719. BOOL bOverlap = FALSE ;
  720. pos = m_listExclusions.GetHeadPosition();
  721. while ( pos )
  722. {
  723. pdhcpRange = m_listExclusions.GetNext(pos);
  724. if ( bOverlap = pdhcpRange->IsOverlap( dhcpIpRange ) )
  725. {
  726. break ;
  727. }
  728. }
  729. return bOverlap ;
  730. }
  731. //
  732. // Fill the exclusions listbox from the current list
  733. //
  734. void
  735. CMScopeWizSetExclusions::Fill
  736. (
  737. int nCurSel,
  738. BOOL bToggleRedraw
  739. )
  740. {
  741. POSITION pos;
  742. CDhcpIpRange * pIpRange ;
  743. CString strIp1 ;
  744. CString strIp2 ;
  745. CString strFormatPair ;
  746. CString strFormatSingleton ;
  747. TCHAR chBuff [STRING_LENGTH_MAX] ;
  748. if ( ! strFormatPair.LoadString( IDS_INFO_FORMAT_IP_RANGE ) )
  749. {
  750. return ;
  751. }
  752. if ( ! strFormatSingleton.LoadString( IDS_INFO_FORMAT_IP_UNITARY ) )
  753. {
  754. return ;
  755. }
  756. if ( bToggleRedraw )
  757. {
  758. m_listboxExclusions.SetRedraw( FALSE ) ;
  759. }
  760. m_listboxExclusions.ResetContent() ;
  761. pos = m_listExclusions.GetHeadPosition();
  762. while ( pos )
  763. {
  764. pIpRange = m_listExclusions.GetNext(pos);
  765. DHCP_IP_RANGE dhipr = *pIpRange ;
  766. CString & strFmt = dhipr.StartAddress == dhipr.EndAddress
  767. ? strFormatSingleton
  768. : strFormatPair ;
  769. //
  770. // Format the IP addresses
  771. //
  772. UtilCvtIpAddrToWstr( dhipr.StartAddress, &strIp1 ) ;
  773. UtilCvtIpAddrToWstr( dhipr.EndAddress, &strIp2 ) ;
  774. //
  775. // Construct the display line
  776. //
  777. ::wsprintf( chBuff,
  778. (LPCTSTR) strFmt,
  779. (LPCTSTR) strIp1,
  780. (LPCTSTR) strIp2 ) ;
  781. //
  782. // Add it to the list box.
  783. //
  784. if ( m_listboxExclusions.AddString( chBuff ) < 0 )
  785. {
  786. break ;
  787. }
  788. }
  789. //
  790. // Check that we loaded the list box successfully.
  791. //
  792. if ( pos != NULL )
  793. {
  794. AfxMessageBox( IDS_ERR_DLG_UPDATE ) ;
  795. }
  796. if ( bToggleRedraw )
  797. {
  798. m_listboxExclusions.SetRedraw( TRUE ) ;
  799. m_listboxExclusions.Invalidate() ;
  800. }
  801. if ( nCurSel >= 0 )
  802. {
  803. m_listboxExclusions.SetCurSel( nCurSel ) ;
  804. }
  805. }
  806. void CMScopeWizSetExclusions::UpdateButtons()
  807. {
  808. DWORD dwAddress;
  809. BOOL bEnable;
  810. m_ipaStart.GetAddress(&dwAddress);
  811. if (dwAddress)
  812. {
  813. bEnable = TRUE;
  814. }
  815. else
  816. {
  817. bEnable = FALSE;
  818. if (m_buttonExclusionAdd.GetButtonStyle() & BS_DEFPUSHBUTTON)
  819. {
  820. m_buttonExclusionAdd.SetButtonStyle(BS_PUSHBUTTON);
  821. }
  822. }
  823. m_buttonExclusionAdd.EnableWindow(bEnable);
  824. if (m_listboxExclusions.GetCurSel() != LB_ERR)
  825. {
  826. bEnable = TRUE;
  827. }
  828. else
  829. {
  830. bEnable = FALSE;
  831. if (m_buttonExclusionDelete.GetButtonStyle() & BS_DEFPUSHBUTTON)
  832. {
  833. m_buttonExclusionDelete.SetButtonStyle(BS_PUSHBUTTON);
  834. }
  835. }
  836. m_buttonExclusionDelete.EnableWindow(bEnable);
  837. }
  838. /////////////////////////////////////////////////////////////////////////////
  839. //
  840. // CMScopeWizLeaseTime property page
  841. //
  842. /////////////////////////////////////////////////////////////////////////////
  843. IMPLEMENT_DYNCREATE(CMScopeWizLeaseTime, CPropertyPageBase)
  844. CMScopeWizLeaseTime::CMScopeWizLeaseTime() : CPropertyPageBase(CMScopeWizLeaseTime::IDD)
  845. {
  846. //{{AFX_DATA_INIT(CMScopeWizLeaseTime)
  847. //}}AFX_DATA_INIT
  848. InitWiz97(FALSE, IDS_MSCOPE_WIZ_LEASE_TITLE, IDS_MSCOPE_WIZ_LEASE_SUBTITLE);
  849. }
  850. CMScopeWizLeaseTime::~CMScopeWizLeaseTime()
  851. {
  852. }
  853. void CMScopeWizLeaseTime::DoDataExchange(CDataExchange* pDX)
  854. {
  855. CPropertyPageBase::DoDataExchange(pDX);
  856. //{{AFX_DATA_MAP(CMScopeWizLeaseTime)
  857. DDX_Control(pDX, IDC_SPIN_LEASE_MINUTES, m_spinMinutes);
  858. DDX_Control(pDX, IDC_SPIN_LEASE_HOURS, m_spinHours);
  859. DDX_Control(pDX, IDC_SPIN_LEASE_DAYS, m_spinDays);
  860. DDX_Control(pDX, IDC_EDIT_LEASE_MINUTES, m_editMinutes);
  861. DDX_Control(pDX, IDC_EDIT_LEASE_HOURS, m_editHours);
  862. DDX_Control(pDX, IDC_EDIT_LEASE_DAYS, m_editDays);
  863. //}}AFX_DATA_MAP
  864. }
  865. BEGIN_MESSAGE_MAP(CMScopeWizLeaseTime, CPropertyPageBase)
  866. //{{AFX_MSG_MAP(CMScopeWizLeaseTime)
  867. ON_BN_CLICKED(IDC_RADIO_LEASE_LIMITED, OnRadioLeaseLimited)
  868. ON_BN_CLICKED(IDC_RADIO_LEASE_UNLIMITED, OnRadioLeaseUnlimited)
  869. ON_EN_CHANGE(IDC_EDIT_LEASE_HOURS, OnChangeEditLeaseHours)
  870. ON_EN_CHANGE(IDC_EDIT_LEASE_MINUTES, OnChangeEditLeaseMinutes)
  871. //}}AFX_MSG_MAP
  872. END_MESSAGE_MAP()
  873. /////////////////////////////////////////////////////////////////////////////
  874. //
  875. // CMScopeWizLeaseTime message handlers
  876. //
  877. /////////////////////////////////////////////////////////////////////////////
  878. BOOL CMScopeWizLeaseTime::OnInitDialog()
  879. {
  880. CPropertyPageBase::OnInitDialog();
  881. m_spinMinutes.SetRange(0, MINUTES_MAX);
  882. m_spinHours.SetRange(0, HOURS_MAX);
  883. m_spinDays.SetRange(0, 999);
  884. m_editMinutes.LimitText(2);
  885. m_editHours.LimitText(2);
  886. m_editDays.LimitText(3);
  887. m_spinMinutes.SetPos(CMScopeWizLeaseTime::m_nMinutesDefault);
  888. m_spinHours.SetPos(CMScopeWizLeaseTime::m_nHoursDefault);
  889. m_spinDays.SetPos(CMScopeWizLeaseTime::m_nDaysDefault);
  890. ActivateDuration(TRUE);
  891. return TRUE; // return TRUE unless you set the focus to a control
  892. // EXCEPTION: OCX Property Pages should return FALSE
  893. }
  894. LRESULT CMScopeWizLeaseTime::OnWizardNext()
  895. {
  896. DWORD dwLeaseTime = GetLeaseTime();
  897. if (dwLeaseTime == 0)
  898. {
  899. AfxMessageBox(IDS_ERR_NO_DURATION_SPECIFIED);
  900. return -1;
  901. }
  902. else
  903. {
  904. return IDW_MSCOPE_ACTIVATE;
  905. }
  906. }
  907. LRESULT CMScopeWizLeaseTime::OnWizardBack()
  908. {
  909. return IDW_MSCOPE_SET_EXCLUSIONS;
  910. }
  911. BOOL CMScopeWizLeaseTime::OnSetActive()
  912. {
  913. GetHolder()->SetWizardButtonsMiddle(TRUE);
  914. return CPropertyPageBase::OnSetActive();
  915. }
  916. void CMScopeWizLeaseTime::OnRadioLeaseLimited()
  917. {
  918. ActivateDuration(TRUE);
  919. }
  920. void CMScopeWizLeaseTime::OnRadioLeaseUnlimited()
  921. {
  922. ActivateDuration(FALSE);
  923. }
  924. void CMScopeWizLeaseTime::OnChangeEditLeaseHours()
  925. {
  926. if (IsWindow(m_editHours.GetSafeHwnd()))
  927. {
  928. CString strText;
  929. m_editHours.GetWindowText(strText);
  930. // check to see if the value is greater than the max
  931. if (_ttoi(strText) > HOURS_MAX)
  932. {
  933. LPTSTR pBuf = strText.GetBuffer(5);
  934. _itot(HOURS_MAX, pBuf, 10);
  935. strText.ReleaseBuffer();
  936. m_editHours.SetWindowText(strText);
  937. m_spinHours.SetPos(HOURS_MAX);
  938. MessageBeep(MB_ICONEXCLAMATION);
  939. }
  940. }
  941. }
  942. void CMScopeWizLeaseTime::OnChangeEditLeaseMinutes()
  943. {
  944. if (IsWindow(m_editMinutes.GetSafeHwnd()))
  945. {
  946. CString strText;
  947. m_editMinutes.GetWindowText(strText);
  948. // check to see if the value is greater than the max
  949. if (_ttoi(strText) > MINUTES_MAX)
  950. {
  951. LPTSTR pBuf = strText.GetBuffer(5);
  952. _itot(MINUTES_MAX, pBuf, 10);
  953. strText.ReleaseBuffer();
  954. m_editMinutes.SetWindowText(strText);
  955. m_spinMinutes.SetPos(MINUTES_MAX);
  956. MessageBeep(MB_ICONEXCLAMATION);
  957. }
  958. }
  959. }
  960. DWORD
  961. CMScopeWizLeaseTime::GetLeaseTime()
  962. {
  963. DWORD dwLeaseTime = 0;
  964. int nDays, nHours, nMinutes;
  965. nDays = m_spinDays.GetPos();
  966. nHours = m_spinHours.GetPos();
  967. nMinutes = m_spinMinutes.GetPos();
  968. //
  969. // Lease time is in minutes so convert
  970. //
  971. dwLeaseTime = UtilConvertLeaseTime(nDays, nHours, nMinutes);
  972. return dwLeaseTime;
  973. }
  974. void
  975. CMScopeWizLeaseTime::ActivateDuration
  976. (
  977. BOOL fActive
  978. )
  979. {
  980. m_spinMinutes.EnableWindow(fActive);
  981. m_spinHours.EnableWindow(fActive);
  982. m_spinDays.EnableWindow(fActive);
  983. m_editMinutes.EnableWindow(fActive);
  984. m_editHours.EnableWindow(fActive);
  985. m_editDays.EnableWindow(fActive);
  986. GetDlgItem(IDC_STATIC_DAYS)->EnableWindow(fActive);
  987. GetDlgItem(IDC_STATIC_HOURS)->EnableWindow(fActive);
  988. GetDlgItem(IDC_STATIC_MINUTES)->EnableWindow(fActive);
  989. }
  990. /////////////////////////////////////////////////////////////////////////////
  991. //
  992. // CMScopeWizFinished property page
  993. //
  994. /////////////////////////////////////////////////////////////////////////////
  995. IMPLEMENT_DYNCREATE(CMScopeWizFinished, CPropertyPageBase)
  996. CMScopeWizFinished::CMScopeWizFinished() : CPropertyPageBase(CMScopeWizFinished::IDD)
  997. {
  998. //{{AFX_DATA_INIT(CMScopeWizFinished)
  999. // NOTE: the ClassWizard will add member initialization here
  1000. //}}AFX_DATA_INIT
  1001. InitWiz97(TRUE, 0, 0);
  1002. }
  1003. CMScopeWizFinished::~CMScopeWizFinished()
  1004. {
  1005. }
  1006. void CMScopeWizFinished::DoDataExchange(CDataExchange* pDX)
  1007. {
  1008. CPropertyPageBase::DoDataExchange(pDX);
  1009. //{{AFX_DATA_MAP(CMScopeWizFinished)
  1010. DDX_Control(pDX, IDC_STATIC_FINISHED_TITLE, m_staticTitle);
  1011. //}}AFX_DATA_MAP
  1012. }
  1013. BEGIN_MESSAGE_MAP(CMScopeWizFinished, CPropertyPageBase)
  1014. //{{AFX_MSG_MAP(CMScopeWizFinished)
  1015. // NOTE: the ClassWizard will add message map macros here
  1016. //}}AFX_MSG_MAP
  1017. END_MESSAGE_MAP()
  1018. /////////////////////////////////////////////////////////////////////////////
  1019. //
  1020. // CMScopeWizFinished message handlers
  1021. //
  1022. /////////////////////////////////////////////////////////////////////////////
  1023. BOOL CMScopeWizFinished::OnInitDialog()
  1024. {
  1025. CPropertyPageBase::OnInitDialog();
  1026. CString strFontName;
  1027. CString strFontSize;
  1028. strFontName.LoadString(IDS_BIG_BOLD_FONT_NAME);
  1029. strFontSize.LoadString(IDS_BIG_BOLD_FONT_SIZE);
  1030. CClientDC dc(this);
  1031. int nFontSize = _ttoi(strFontSize) * 10;
  1032. if (m_fontBig.CreatePointFont(nFontSize, strFontName, &dc))
  1033. m_staticTitle.SetFont(&m_fontBig);
  1034. return TRUE; // return TRUE unless you set the focus to a control
  1035. // EXCEPTION: OCX Property Pages should return FALSE
  1036. }
  1037. BOOL CMScopeWizFinished::OnWizardFinish()
  1038. {
  1039. DWORD err;
  1040. BEGIN_WAIT_CURSOR;
  1041. err = GetHolder()->OnFinish();
  1042. END_WAIT_CURSOR;
  1043. if (err)
  1044. {
  1045. ::DhcpMessageBox(err);
  1046. return FALSE;
  1047. }
  1048. else
  1049. {
  1050. return TRUE;
  1051. }
  1052. }
  1053. BOOL CMScopeWizFinished::OnSetActive()
  1054. {
  1055. GetHolder()->SetWizardButtonsLast(TRUE);
  1056. return CPropertyPageBase::OnSetActive();
  1057. }
  1058. /////////////////////////////////////////////////////////////////////////////
  1059. // CMScopeWizWelcome property page
  1060. IMPLEMENT_DYNCREATE(CMScopeWizWelcome, CPropertyPageBase)
  1061. CMScopeWizWelcome::CMScopeWizWelcome() : CPropertyPageBase(CMScopeWizWelcome::IDD)
  1062. {
  1063. //{{AFX_DATA_INIT(CMScopeWizWelcome)
  1064. // NOTE: the ClassWizard will add member initialization here
  1065. //}}AFX_DATA_INIT
  1066. InitWiz97(TRUE, 0, 0);
  1067. }
  1068. CMScopeWizWelcome::~CMScopeWizWelcome()
  1069. {
  1070. }
  1071. void CMScopeWizWelcome::DoDataExchange(CDataExchange* pDX)
  1072. {
  1073. CPropertyPage::DoDataExchange(pDX);
  1074. //{{AFX_DATA_MAP(CMScopeWizWelcome)
  1075. DDX_Control(pDX, IDC_STATIC_WELCOME_TITLE, m_staticTitle);
  1076. //}}AFX_DATA_MAP
  1077. }
  1078. BEGIN_MESSAGE_MAP(CMScopeWizWelcome, CPropertyPageBase)
  1079. //{{AFX_MSG_MAP(CMScopeWizWelcome)
  1080. //}}AFX_MSG_MAP
  1081. END_MESSAGE_MAP()
  1082. /////////////////////////////////////////////////////////////////////////////
  1083. // CMScopeWizWelcome message handlers
  1084. BOOL CMScopeWizWelcome::OnInitDialog()
  1085. {
  1086. CPropertyPageBase::OnInitDialog();
  1087. CString strFontName;
  1088. CString strFontSize;
  1089. strFontName.LoadString(IDS_BIG_BOLD_FONT_NAME);
  1090. strFontSize.LoadString(IDS_BIG_BOLD_FONT_SIZE);
  1091. CClientDC dc(this);
  1092. int nFontSize = _ttoi(strFontSize) * 10;
  1093. if (m_fontBig.CreatePointFont(nFontSize, strFontName, &dc))
  1094. m_staticTitle.SetFont(&m_fontBig);
  1095. return TRUE; // return TRUE unless you set the focus to a control
  1096. // EXCEPTION: OCX Property Pages should return FALSE
  1097. }
  1098. BOOL CMScopeWizWelcome::OnSetActive()
  1099. {
  1100. GetHolder()->SetWizardButtonsFirst(TRUE);
  1101. return CPropertyPage::OnSetActive();
  1102. }
  1103. /////////////////////////////////////////////////////////////////////////////
  1104. // CMScopeWizActivate property page
  1105. IMPLEMENT_DYNCREATE(CMScopeWizActivate, CPropertyPageBase)
  1106. CMScopeWizActivate::CMScopeWizActivate() : CPropertyPageBase(CMScopeWizActivate::IDD)
  1107. {
  1108. //{{AFX_DATA_INIT(CMScopeWizActivate)
  1109. // NOTE: the ClassWizard will add member initialization here
  1110. //}}AFX_DATA_INIT
  1111. m_fActivate = TRUE;
  1112. InitWiz97(FALSE, IDS_MSCOPE_WIZ_ACTIVATE_TITLE, IDS_MSCOPE_WIZ_ACTIVATE_SUBTITLE);
  1113. }
  1114. CMScopeWizActivate::~CMScopeWizActivate()
  1115. {
  1116. }
  1117. void CMScopeWizActivate::DoDataExchange(CDataExchange* pDX)
  1118. {
  1119. CPropertyPageBase::DoDataExchange(pDX);
  1120. //{{AFX_DATA_MAP(CMScopeWizActivate)
  1121. DDX_Control(pDX, IDC_RADIO_YES, m_radioYes);
  1122. //}}AFX_DATA_MAP
  1123. }
  1124. BEGIN_MESSAGE_MAP(CMScopeWizActivate, CPropertyPageBase)
  1125. //{{AFX_MSG_MAP(CMScopeWizActivate)
  1126. //}}AFX_MSG_MAP
  1127. END_MESSAGE_MAP()
  1128. /////////////////////////////////////////////////////////////////////////////
  1129. // CMScopeWizActivate message handlers
  1130. BOOL CMScopeWizActivate::OnInitDialog()
  1131. {
  1132. CPropertyPageBase::OnInitDialog();
  1133. m_radioYes.SetCheck(TRUE);
  1134. return TRUE; // return TRUE unless you set the focus to a control
  1135. // EXCEPTION: OCX Property Pages should return FALSE
  1136. }
  1137. LRESULT CMScopeWizActivate::OnWizardNext()
  1138. {
  1139. m_fActivate = m_radioYes.GetCheck();
  1140. return CPropertyPageBase::OnWizardNext();
  1141. }
  1142. BOOL CMScopeWizActivate::OnSetActive()
  1143. {
  1144. GetHolder()->SetWizardButtonsMiddle(TRUE);
  1145. return CPropertyPageBase::OnSetActive();
  1146. }