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.

752 lines
19 KiB

  1. /**********************************************************************/
  2. /** Microsoft Windows/NT **/
  3. /** Copyright(c) Microsoft Corporation, 1997 - 1999 **/
  4. /**********************************************************************/
  5. /*
  6. sscopwiz.cpp
  7. Superscope creation wizards.
  8. FILE HISTORY:
  9. */
  10. #include "stdafx.h"
  11. #include "sscopwiz.h"
  12. #include "server.h"
  13. #include "scope.h"
  14. // compare function for the sorting of IP addresses in the available scopes box
  15. int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
  16. {
  17. int nCompare = 0;
  18. if (lParam1 > lParam2)
  19. {
  20. nCompare = 1;
  21. }
  22. else
  23. if (lParam1 < lParam2)
  24. {
  25. nCompare = -1;
  26. }
  27. return nCompare;
  28. }
  29. /////////////////////////////////////////////////////////////////////////////
  30. //
  31. // CSuperscopeWiz holder
  32. //
  33. /////////////////////////////////////////////////////////////////////////////
  34. CSuperscopeWiz::CSuperscopeWiz
  35. (
  36. ITFSNode * pNode,
  37. IComponentData * pComponentData,
  38. ITFSComponentData * pTFSCompData,
  39. LPCTSTR pszSheetName
  40. ) : CPropertyPageHolderBase(pNode, pComponentData, pszSheetName)
  41. {
  42. //ASSERT(pFolderNode == GetContainerNode());
  43. m_bAutoDeletePages = FALSE; // we have the pages as embedded members
  44. AddPageToList((CPropertyPageBase*)&m_pageWelcome);
  45. AddPageToList((CPropertyPageBase*)&m_pageName);
  46. AddPageToList((CPropertyPageBase*)&m_pageError);
  47. AddPageToList((CPropertyPageBase*)&m_pageSelectScopes);
  48. AddPageToList((CPropertyPageBase*)&m_pageConfirm);
  49. m_pQueryObject = NULL;
  50. m_spTFSCompData.Set(pTFSCompData);
  51. m_bWiz97 = TRUE;
  52. m_spTFSCompData->SetWatermarkInfo(&g_WatermarkInfoScope);
  53. }
  54. CSuperscopeWiz::~CSuperscopeWiz()
  55. {
  56. RemovePageFromList((CPropertyPageBase*) &m_pageWelcome, FALSE);
  57. RemovePageFromList((CPropertyPageBase*) &m_pageName, FALSE);
  58. RemovePageFromList((CPropertyPageBase*) &m_pageError, FALSE);
  59. RemovePageFromList((CPropertyPageBase*) &m_pageSelectScopes, FALSE);
  60. RemovePageFromList((CPropertyPageBase*) &m_pageConfirm, FALSE);
  61. if (m_pQueryObject)
  62. {
  63. LPQUEUEDATA pQD = NULL;
  64. while (pQD = m_pQueryObject->RemoveFromQueue())
  65. {
  66. // smart pointer will release node
  67. SPITFSNode spNode;
  68. spNode = reinterpret_cast<ITFSNode *>(pQD->Data);
  69. delete pQD;
  70. spNode->DeleteAllChildren(FALSE); // don't remove from UI, not added
  71. }
  72. m_pQueryObject->Release();
  73. }
  74. }
  75. //
  76. // Called from the OnWizardFinish to create the new superscope
  77. //
  78. DWORD
  79. CSuperscopeWiz::OnFinish()
  80. {
  81. DWORD dwReturn = 0;
  82. DHCP_SUBNET_STATE dhcpSuperscopeState = DhcpSubnetDisabled;
  83. SPITFSNode spServerNode;
  84. LPDHCP_SUBNET_INFO pdhcpSubnetInfo;
  85. BEGIN_WAIT_CURSOR;
  86. spServerNode = GetNode();
  87. CDhcpServer * pServer = GETHANDLER(CDhcpServer, spServerNode);
  88. int nScopeCount = m_pageConfirm.m_listboxSelectedScopes.GetCount();
  89. for (int i = 0; i < nScopeCount; i++)
  90. {
  91. DHCP_IP_ADDRESS dhcpSubnetAddress = (DHCP_IP_ADDRESS) m_pageConfirm.m_listboxSelectedScopes.GetItemData(i);
  92. dwReturn = ::DhcpSetSuperScopeV4(pServer->GetIpAddress(),
  93. dhcpSubnetAddress,
  94. (LPWSTR) ((LPCTSTR) m_pageName.m_strSuperscopeName),
  95. FALSE);
  96. if (dwReturn != ERROR_SUCCESS)
  97. {
  98. TRACE(_T("CSuperscopeWiz::OnFinish() - DhcpSetSuperScopeV4 failed!! %d\n"), dwReturn);
  99. break;
  100. }
  101. // check to see if the subnet is enabled so we can set the superscope state later
  102. dwReturn = ::DhcpGetSubnetInfo((LPWSTR) pServer->GetIpAddress(),
  103. dhcpSubnetAddress,
  104. &pdhcpSubnetInfo);
  105. if (dwReturn == ERROR_SUCCESS)
  106. {
  107. if (pdhcpSubnetInfo->SubnetState == DhcpSubnetEnabled)
  108. dhcpSuperscopeState = DhcpSubnetEnabled;
  109. ::DhcpRpcFreeMemory(pdhcpSubnetInfo);
  110. }
  111. }
  112. if (dwReturn == ERROR_SUCCESS)
  113. {
  114. // Create the new superscope node
  115. CDhcpSuperscope * pSuperscope;
  116. SPITFSNode spSuperscopeNode;
  117. SPITFSNodeMgr spNodeMgr;
  118. spServerNode->GetNodeMgr(&spNodeMgr);
  119. pSuperscope = new CDhcpSuperscope(m_spTFSCompData, m_pageName.m_strSuperscopeName);
  120. CreateContainerTFSNode(&spSuperscopeNode,
  121. &GUID_DhcpSuperscopeNodeType,
  122. pSuperscope,
  123. pSuperscope,
  124. spNodeMgr);
  125. pSuperscope->SetState(dhcpSuperscopeState);
  126. // Tell the handler to initialize any specific data
  127. pSuperscope->InitializeNode(spSuperscopeNode);
  128. pSuperscope->SetServer(spServerNode);
  129. // Add the node as a child to this node
  130. CDhcpServer * pServer = GETHANDLER(CDhcpServer, spServerNode);
  131. pServer->AddSuperscopeSorted(spServerNode, spSuperscopeNode);
  132. pSuperscope->Release();
  133. //
  134. // Now look for any scopes that we just created and move them
  135. // as a child of the new superscope node
  136. SPITFSNodeEnum spNodeEnum;
  137. SPITFSNode spCurrentNode;
  138. DWORD nNumReturned;
  139. spServerNode->GetEnum(&spNodeEnum);
  140. for (i = 0; i < nScopeCount; i++)
  141. {
  142. DHCP_IP_ADDRESS dhcpSubnetAddress = (DHCP_IP_ADDRESS) m_pageConfirm.m_listboxSelectedScopes.GetItemData(i);
  143. spNodeEnum->Reset();
  144. spNodeEnum->Next(1, &spCurrentNode, &nNumReturned);
  145. while (nNumReturned)
  146. {
  147. // is this node a scope? -- could be a superscope, bootp folder or global options
  148. if (spCurrentNode->GetData(TFS_DATA_TYPE) == DHCPSNAP_SCOPE)
  149. {
  150. CDhcpScope * pScope = GETHANDLER(CDhcpScope, spCurrentNode);
  151. // is this a scope that we just added to the superscope?
  152. if (pScope->GetAddress() == dhcpSubnetAddress)
  153. {
  154. // We just remove this node from the server list and don't
  155. // add it to the new superscope node because it will just get
  156. // enumerated when the user clicks on the new superscope.
  157. spServerNode->RemoveChild(spCurrentNode);
  158. }
  159. }
  160. spCurrentNode.Release();
  161. spNodeEnum->Next(1, &spCurrentNode, &nNumReturned);
  162. }
  163. }
  164. }
  165. END_WAIT_CURSOR;
  166. return dwReturn;
  167. }
  168. HRESULT
  169. CSuperscopeWiz::GetScopeInfo()
  170. {
  171. HRESULT hr = hrOK;
  172. SPITFSNode spServerNode;
  173. spServerNode = GetNode();
  174. CDhcpServer * pServer = GETHANDLER(CDhcpServer, spServerNode);
  175. m_pQueryObject = reinterpret_cast<CDHCPQueryObj * >(pServer->OnCreateQuery(spServerNode));
  176. if (!m_pQueryObject)
  177. {
  178. return E_FAIL;
  179. }
  180. (reinterpret_cast<CDhcpServerQueryObj *> (m_pQueryObject))->EnumSubnetsV4();
  181. return hr;
  182. }
  183. BOOL
  184. CSuperscopeWiz::DoesSuperscopeExist
  185. (
  186. LPCTSTR pSuperscopeName
  187. )
  188. {
  189. // walk our cached information to see if the superscope already exists
  190. CString strNewName = pSuperscopeName;
  191. BOOL bExists = FALSE;
  192. CQueueDataListBase & listQData = m_pQueryObject->GetQueue();
  193. POSITION pos;
  194. pos = listQData.GetHeadPosition();
  195. while (pos)
  196. {
  197. LPQUEUEDATA pQD = listQData.GetNext(pos);
  198. Assert(pQD->Type == QDATA_PNODE);
  199. ITFSNode * pNode = reinterpret_cast<ITFSNode *>(pQD->Data);
  200. if (pNode->GetData(TFS_DATA_TYPE) == DHCPSNAP_SUPERSCOPE)
  201. {
  202. CDhcpSuperscope * pSScope = GETHANDLER(CDhcpSuperscope, pNode);
  203. if (strNewName.Compare(pSScope->GetName()) == 0)
  204. {
  205. bExists = TRUE;
  206. break;
  207. }
  208. }
  209. }
  210. return bExists;
  211. }
  212. HRESULT
  213. CSuperscopeWiz::FillAvailableScopes
  214. (
  215. CListCtrl & listboxScopes
  216. )
  217. {
  218. HRESULT hr = hrOK;
  219. int nCount = 0;
  220. CQueueDataListBase & listQData = m_pQueryObject->GetQueue();
  221. POSITION pos;
  222. pos = listQData.GetHeadPosition();
  223. while (pos)
  224. {
  225. LPQUEUEDATA pQD = listQData.GetNext(pos);
  226. Assert(pQD->Type == QDATA_PNODE);
  227. ITFSNode * pNode = reinterpret_cast<ITFSNode *>(pQD->Data);
  228. if (pNode->GetData(TFS_DATA_TYPE) == DHCPSNAP_SCOPE)
  229. {
  230. CDhcpScope * pScope = GETHANDLER(CDhcpScope, pNode);
  231. CString strSuperscopeFormat, strSuperscopeName, strScopeAddress;
  232. // build the display name
  233. UtilCvtIpAddrToWstr (pScope->GetAddress(),
  234. &strScopeAddress);
  235. strSuperscopeFormat.LoadString(IDS_INFO_FORMAT_SCOPE_NAME);
  236. strSuperscopeName.Format(strSuperscopeFormat, strScopeAddress, pScope->GetName());
  237. int nIndex = listboxScopes.InsertItem(nCount, strSuperscopeName);
  238. listboxScopes.SetItemData(nIndex, pScope->GetAddress());
  239. nCount++;
  240. }
  241. }
  242. listboxScopes.SortItems( CompareFunc, NULL );
  243. return hr;
  244. }
  245. /////////////////////////////////////////////////////////////////////////////
  246. //
  247. // CSuperscopeWizName property page
  248. //
  249. /////////////////////////////////////////////////////////////////////////////
  250. IMPLEMENT_DYNCREATE(CSuperscopeWizName, CPropertyPageBase)
  251. CSuperscopeWizName::CSuperscopeWizName() :
  252. CPropertyPageBase(CSuperscopeWizName::IDD)
  253. {
  254. //{{AFX_DATA_INIT(CSuperscopeWizName)
  255. m_strSuperscopeName = _T("");
  256. //}}AFX_DATA_INIT
  257. InitWiz97(FALSE, IDS_SUPERSCOPE_WIZ_NAME_TITLE, IDS_SUPERSCOPE_WIZ_NAME_SUBTITLE);
  258. }
  259. CSuperscopeWizName::~CSuperscopeWizName()
  260. {
  261. }
  262. void CSuperscopeWizName::DoDataExchange(CDataExchange* pDX)
  263. {
  264. CPropertyPageBase::DoDataExchange(pDX);
  265. //{{AFX_DATA_MAP(CSuperscopeWizName)
  266. DDX_Text(pDX, IDC_EDIT_SUPERSCOPE_NAME, m_strSuperscopeName);
  267. //}}AFX_DATA_MAP
  268. }
  269. BEGIN_MESSAGE_MAP(CSuperscopeWizName, CPropertyPageBase)
  270. //{{AFX_MSG_MAP(CSuperscopeWizName)
  271. ON_EN_CHANGE(IDC_EDIT_SUPERSCOPE_NAME, OnChangeEditSuperscopeName)
  272. //}}AFX_MSG_MAP
  273. END_MESSAGE_MAP()
  274. /////////////////////////////////////////////////////////////////////////////
  275. //
  276. // CSuperscopeWizName message handlers
  277. //
  278. /////////////////////////////////////////////////////////////////////////////
  279. BOOL CSuperscopeWizName::OnInitDialog()
  280. {
  281. CPropertyPageBase::OnInitDialog();
  282. return TRUE; // return TRUE unless you set the focus to a control
  283. // EXCEPTION: OCX Property Pages should return FALSE
  284. }
  285. LRESULT CSuperscopeWizName::OnWizardNext()
  286. {
  287. UpdateData();
  288. CSuperscopeWiz * pSScopeWiz =
  289. reinterpret_cast<CSuperscopeWiz *>(GetHolder());
  290. if (pSScopeWiz->DoesSuperscopeExist(m_strSuperscopeName) == TRUE)
  291. {
  292. //
  293. // Go to the error page
  294. //
  295. AfxMessageBox(IDS_ERR_SUPERSCOPE_NAME_IN_USE);
  296. GetDlgItem(IDC_EDIT_SUPERSCOPE_NAME)->SetFocus();
  297. return -1;
  298. }
  299. else
  300. {
  301. //
  302. // Go to the next valid page
  303. //
  304. return IDW_SUPERSCOPE_SELECT_SCOPES;
  305. }
  306. }
  307. BOOL CSuperscopeWizName::OnSetActive()
  308. {
  309. SetButtons();
  310. return CPropertyPageBase::OnSetActive();
  311. }
  312. void CSuperscopeWizName::OnChangeEditSuperscopeName()
  313. {
  314. SetButtons();
  315. }
  316. void CSuperscopeWizName::SetButtons()
  317. {
  318. UpdateData();
  319. if (m_strSuperscopeName.IsEmpty())
  320. {
  321. GetHolder()->SetWizardButtonsMiddle(FALSE);
  322. }
  323. else
  324. {
  325. GetHolder()->SetWizardButtonsMiddle(TRUE);
  326. }
  327. }
  328. /////////////////////////////////////////////////////////////////////////////
  329. //
  330. // CSuperscopeWizError property page
  331. //
  332. /////////////////////////////////////////////////////////////////////////////
  333. IMPLEMENT_DYNCREATE(CSuperscopeWizError, CPropertyPageBase)
  334. CSuperscopeWizError::CSuperscopeWizError() :
  335. CPropertyPageBase(CSuperscopeWizError::IDD)
  336. {
  337. //{{AFX_DATA_INIT(CSuperscopeWizError)
  338. // NOTE: the ClassWizard will add member initialization here
  339. //}}AFX_DATA_INIT
  340. InitWiz97(FALSE, IDS_SUPERSCOPE_WIZ_ERROR_TITLE, IDS_SUPERSCOPE_WIZ_ERROR_SUBTITLE);
  341. }
  342. CSuperscopeWizError::~CSuperscopeWizError()
  343. {
  344. }
  345. void CSuperscopeWizError::DoDataExchange(CDataExchange* pDX)
  346. {
  347. CPropertyPageBase::DoDataExchange(pDX);
  348. //{{AFX_DATA_MAP(CSuperscopeWizError)
  349. // NOTE: the ClassWizard will add DDX and DDV calls here
  350. //}}AFX_DATA_MAP
  351. }
  352. BEGIN_MESSAGE_MAP(CSuperscopeWizError, CPropertyPageBase)
  353. //{{AFX_MSG_MAP(CSuperscopeWizError)
  354. //}}AFX_MSG_MAP
  355. END_MESSAGE_MAP()
  356. /////////////////////////////////////////////////////////////////////////////
  357. //
  358. // CSuperscopeWizError message handlers
  359. //
  360. /////////////////////////////////////////////////////////////////////////////
  361. BOOL CSuperscopeWizError::OnInitDialog()
  362. {
  363. CPropertyPageBase::OnInitDialog();
  364. return TRUE; // return TRUE unless you set the focus to a control
  365. // EXCEPTION: OCX Property Pages should return FALSE
  366. }
  367. BOOL CSuperscopeWizError::OnSetActive()
  368. {
  369. GetHolder()->SetWizardButtonsMiddle(FALSE);
  370. return CPropertyPageBase::OnSetActive();
  371. }
  372. /////////////////////////////////////////////////////////////////////////////
  373. //
  374. // CSuperscopeWizSelectScopes property page
  375. //
  376. /////////////////////////////////////////////////////////////////////////////
  377. IMPLEMENT_DYNCREATE(CSuperscopeWizSelectScopes, CPropertyPageBase)
  378. CSuperscopeWizSelectScopes::CSuperscopeWizSelectScopes() :
  379. CPropertyPageBase(CSuperscopeWizSelectScopes::IDD)
  380. {
  381. //{{AFX_DATA_INIT(CSuperscopeWizSelectScopes)
  382. // NOTE: the ClassWizard will add member initialization here
  383. //}}AFX_DATA_INIT
  384. InitWiz97(FALSE, IDS_SUPERSCOPE_WIZ_SELECT_TITLE, IDS_SUPERSCOPE_WIZ_SELECT_SUBTITLE);
  385. }
  386. CSuperscopeWizSelectScopes::~CSuperscopeWizSelectScopes()
  387. {
  388. }
  389. void CSuperscopeWizSelectScopes::DoDataExchange(CDataExchange* pDX)
  390. {
  391. CPropertyPageBase::DoDataExchange(pDX);
  392. //{{AFX_DATA_MAP(CSuperscopeWizSelectScopes)
  393. DDX_Control(pDX, IDC_LIST_AVAILABLE_SCOPES, m_listboxAvailScopes);
  394. //}}AFX_DATA_MAP
  395. }
  396. BEGIN_MESSAGE_MAP(CSuperscopeWizSelectScopes, CPropertyPageBase)
  397. //{{AFX_MSG_MAP(CSuperscopeWizSelectScopes)
  398. ON_LBN_SELCHANGE(IDC_LIST_AVAILABLE_SCOPES, OnSelchangeListAvailableScopes)
  399. ON_NOTIFY(LVN_ITEMCHANGED, IDC_LIST_AVAILABLE_SCOPES, OnItemchangedListAvailableScopes)
  400. //}}AFX_MSG_MAP
  401. END_MESSAGE_MAP()
  402. /////////////////////////////////////////////////////////////////////////////
  403. //
  404. // CSuperscopeWizSelectScopes message handlers
  405. //
  406. /////////////////////////////////////////////////////////////////////////////
  407. BOOL CSuperscopeWizSelectScopes::OnInitDialog()
  408. {
  409. CPropertyPageBase::OnInitDialog();
  410. CSuperscopeWiz * pSScopeWiz = reinterpret_cast<CSuperscopeWiz *>(GetHolder());
  411. RECT rect;
  412. m_listboxAvailScopes.GetWindowRect(&rect);
  413. m_listboxAvailScopes.InsertColumn(0, _T(""), LVCFMT_LEFT, rect.right - rect.left - 20);
  414. ListView_SetExtendedListViewStyle(m_listboxAvailScopes.GetSafeHwnd(), LVS_EX_FULLROWSELECT);
  415. pSScopeWiz->FillAvailableScopes(m_listboxAvailScopes);
  416. return TRUE; // return TRUE unless you set the focus to a control
  417. // EXCEPTION: OCX Property Pages should return FALSE
  418. }
  419. LRESULT CSuperscopeWizSelectScopes::OnWizardBack()
  420. {
  421. //
  422. // Go back to the first page
  423. //
  424. return IDW_SUPERSCOPE_NAME;
  425. }
  426. LRESULT CSuperscopeWizSelectScopes::OnWizardNext()
  427. {
  428. // TODO: Add your specialized code here and/or call the base class
  429. return CPropertyPageBase::OnWizardNext();
  430. }
  431. BOOL CSuperscopeWizSelectScopes::OnSetActive()
  432. {
  433. SetButtons();
  434. return CPropertyPageBase::OnSetActive();
  435. }
  436. void CSuperscopeWizSelectScopes::OnSelchangeListAvailableScopes()
  437. {
  438. SetButtons();
  439. }
  440. void CSuperscopeWizSelectScopes::OnItemchangedListAvailableScopes(NMHDR* pNMHDR, LRESULT* pResult)
  441. {
  442. NM_LISTVIEW* pNMListView = (NM_LISTVIEW*)pNMHDR;
  443. SetButtons();
  444. *pResult = 0;
  445. }
  446. void CSuperscopeWizSelectScopes::SetButtons()
  447. {
  448. if (m_listboxAvailScopes.GetSelectedCount() > 0)
  449. {
  450. GetHolder()->SetWizardButtonsMiddle(TRUE);
  451. }
  452. else
  453. {
  454. GetHolder()->SetWizardButtonsMiddle(FALSE);
  455. }
  456. }
  457. /////////////////////////////////////////////////////////////////////////////
  458. //
  459. // CSuperscopeWizConfirm property page
  460. //
  461. /////////////////////////////////////////////////////////////////////////////
  462. IMPLEMENT_DYNCREATE(CSuperscopeWizConfirm, CPropertyPageBase)
  463. CSuperscopeWizConfirm::CSuperscopeWizConfirm() :
  464. CPropertyPageBase(CSuperscopeWizConfirm::IDD)
  465. {
  466. //{{AFX_DATA_INIT(CSuperscopeWizConfirm)
  467. //}}AFX_DATA_INIT
  468. InitWiz97(TRUE, 0, 0);
  469. }
  470. CSuperscopeWizConfirm::~CSuperscopeWizConfirm()
  471. {
  472. }
  473. void CSuperscopeWizConfirm::DoDataExchange(CDataExchange* pDX)
  474. {
  475. CPropertyPageBase::DoDataExchange(pDX);
  476. //{{AFX_DATA_MAP(CSuperscopeWizConfirm)
  477. DDX_Control(pDX, IDC_STATIC_FINISHED_TITLE, m_staticTitle);
  478. DDX_Control(pDX, IDC_LIST_SELECTED_SCOPES, m_listboxSelectedScopes);
  479. DDX_Control(pDX, IDC_EDIT_NAME, m_editName);
  480. //}}AFX_DATA_MAP
  481. }
  482. BEGIN_MESSAGE_MAP(CSuperscopeWizConfirm, CPropertyPageBase)
  483. //{{AFX_MSG_MAP(CSuperscopeWizConfirm)
  484. //}}AFX_MSG_MAP
  485. END_MESSAGE_MAP()
  486. /////////////////////////////////////////////////////////////////////////////
  487. //
  488. // CSuperscopeWizConfirm message handlers
  489. //
  490. /////////////////////////////////////////////////////////////////////////////
  491. BOOL CSuperscopeWizConfirm::OnInitDialog()
  492. {
  493. CPropertyPageBase::OnInitDialog();
  494. CString strFontName;
  495. CString strFontSize;
  496. strFontName.LoadString(IDS_BIG_BOLD_FONT_NAME);
  497. strFontSize.LoadString(IDS_BIG_BOLD_FONT_SIZE);
  498. CClientDC dc(this);
  499. int nFontSize = _ttoi(strFontSize) * 10;
  500. if (m_fontBig.CreatePointFont(nFontSize, strFontName, &dc))
  501. m_staticTitle.SetFont(&m_fontBig);
  502. return TRUE; // return TRUE unless you set the focus to a control
  503. // EXCEPTION: OCX Property Pages should return FALSE
  504. }
  505. BOOL CSuperscopeWizConfirm::OnWizardFinish()
  506. {
  507. //
  508. // Tell the wizard holder that we need to finish
  509. //
  510. DWORD dwErr = GetHolder()->OnFinish();
  511. if (dwErr != ERROR_SUCCESS)
  512. {
  513. ::DhcpMessageBox(dwErr);
  514. return FALSE;
  515. }
  516. return (dwErr == ERROR_SUCCESS) ? TRUE : FALSE;
  517. }
  518. BOOL CSuperscopeWizConfirm::OnSetActive()
  519. {
  520. GetHolder()->SetWizardButtonsLast(TRUE);
  521. CSuperscopeWiz * pSScopeWiz =
  522. reinterpret_cast<CSuperscopeWiz *>(GetHolder());
  523. // Get the new superscope name and set the window text
  524. m_editName.SetWindowText(pSScopeWiz->m_pageName.m_strSuperscopeName);
  525. int nSelCount = pSScopeWiz->m_pageSelectScopes.m_listboxAvailScopes.GetSelectedCount();
  526. int * pSelItemsArray = (int *) alloca(nSelCount * sizeof(int));
  527. // now get the selected scope names and build our list
  528. m_listboxSelectedScopes.ResetContent();
  529. int nItem = pSScopeWiz->m_pageSelectScopes.m_listboxAvailScopes.GetNextItem(-1, LVNI_SELECTED);
  530. while (nItem != -1)
  531. {
  532. CString strText = pSScopeWiz->m_pageSelectScopes.m_listboxAvailScopes.GetItemText(nItem, 0);
  533. int nIndex = m_listboxSelectedScopes.AddString(strText);
  534. m_listboxSelectedScopes.SetItemData(nIndex,
  535. pSScopeWiz->m_pageSelectScopes.m_listboxAvailScopes.GetItemData(nItem));
  536. nItem = pSScopeWiz->m_pageSelectScopes.m_listboxAvailScopes.GetNextItem(nItem, LVNI_SELECTED);
  537. }
  538. return CPropertyPageBase::OnSetActive();
  539. }
  540. /////////////////////////////////////////////////////////////////////////////
  541. // CSuperscopeWizWelcome property page
  542. IMPLEMENT_DYNCREATE(CSuperscopeWizWelcome, CPropertyPageBase)
  543. CSuperscopeWizWelcome::CSuperscopeWizWelcome() : CPropertyPageBase(CSuperscopeWizWelcome::IDD)
  544. {
  545. //{{AFX_DATA_INIT(CSuperscopeWizWelcome)
  546. // NOTE: the ClassWizard will add member initialization here
  547. //}}AFX_DATA_INIT
  548. InitWiz97(TRUE, 0, 0);
  549. }
  550. CSuperscopeWizWelcome::~CSuperscopeWizWelcome()
  551. {
  552. }
  553. void CSuperscopeWizWelcome::DoDataExchange(CDataExchange* pDX)
  554. {
  555. CPropertyPage::DoDataExchange(pDX);
  556. //{{AFX_DATA_MAP(CSuperscopeWizWelcome)
  557. DDX_Control(pDX, IDC_STATIC_WELCOME_TITLE, m_staticTitle);
  558. //}}AFX_DATA_MAP
  559. }
  560. BEGIN_MESSAGE_MAP(CSuperscopeWizWelcome, CPropertyPageBase)
  561. //{{AFX_MSG_MAP(CSuperscopeWizWelcome)
  562. //}}AFX_MSG_MAP
  563. END_MESSAGE_MAP()
  564. /////////////////////////////////////////////////////////////////////////////
  565. // CSuperscopeWizWelcome message handlers
  566. BOOL CSuperscopeWizWelcome::OnInitDialog()
  567. {
  568. CPropertyPageBase::OnInitDialog();
  569. CString strFontName;
  570. CString strFontSize;
  571. strFontName.LoadString(IDS_BIG_BOLD_FONT_NAME);
  572. strFontSize.LoadString(IDS_BIG_BOLD_FONT_SIZE);
  573. CClientDC dc(this);
  574. int nFontSize = _ttoi(strFontSize) * 10;
  575. if (m_fontBig.CreatePointFont(nFontSize, strFontName, &dc))
  576. m_staticTitle.SetFont(&m_fontBig);
  577. return TRUE; // return TRUE unless you set the focus to a control
  578. // EXCEPTION: OCX Property Pages should return FALSE
  579. }
  580. BOOL CSuperscopeWizWelcome::OnSetActive()
  581. {
  582. GetHolder()->SetWizardButtonsFirst(TRUE);
  583. return CPropertyPageBase::OnSetActive();
  584. }