Leaked source code of windows server 2003
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.

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