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.

932 lines
22 KiB

  1. //////////////////////////////////////////////////////////////////////////////
  2. /*++
  3. Copyright (C) Microsoft Corporation, 1998 - 1999
  4. Module Name:
  5. IASVendorSpecificEditorPage.cpp
  6. Abstract:
  7. Implementation file for the CIASPgVendorSpecAttr class.
  8. Revision History:
  9. mmaguire 06/25/98 - revised Baogang Yao's original implementation
  10. --*/
  11. //////////////////////////////////////////////////////////////////////////////
  12. //////////////////////////////////////////////////////////////////////////////
  13. // BEGIN INCLUDES
  14. //
  15. // standard includes:
  16. //
  17. #include "Precompiled.h"
  18. #include <winsock2.h>
  19. //
  20. // where we can find declaration for main class in this file:
  21. //
  22. #include "IASVendorSpecificEditorPage.h"
  23. //
  24. // where we can find declarations needed in this file:
  25. //
  26. #include "iashelper.h"
  27. //
  28. // END INCLUDES
  29. //////////////////////////////////////////////////////////////////////////////
  30. // Some forward declarations of classes used only in this file.
  31. /////////////////////////////////////////////////////////////////////////////
  32. // CIASVendorSpecificConformsYes dialog
  33. class CIASVendorSpecificConformsYes: public CHelpDialog
  34. {
  35. DECLARE_DYNCREATE(CIASVendorSpecificConformsYes)
  36. // Construction
  37. public:
  38. CIASVendorSpecificConformsYes();
  39. ~CIASVendorSpecificConformsYes();
  40. // Dialog Data
  41. //{{AFX_DATA(CIASVendorSpecificConformsYes)
  42. enum { IDD = IDD_IAS_VENDORSPEC_ATTR_CONFORMS_YES };
  43. ::CString m_strDispValue;
  44. int m_dType;
  45. int m_dFormat;
  46. //}}AFX_DATA
  47. // Overrides
  48. // ClassWizard generate virtual function overrides
  49. //{{AFX_VIRTUAL(CIASVendorSpecificConformsYes)
  50. protected:
  51. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  52. //}}AFX_VIRTUAL
  53. // Implementation
  54. private:
  55. BOOL m_fInitializing;
  56. protected:
  57. // Generated message map functions
  58. //{{AFX_MSG(CIASVendorSpecificConformsYes)
  59. virtual BOOL OnInitDialog();
  60. // afx_msg void OnContextMenu(CWnd* pWnd, ::CPoint point);
  61. // afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
  62. afx_msg void OnSelchangeFormat();
  63. //}}AFX_MSG
  64. DECLARE_MESSAGE_MAP()
  65. };
  66. /////////////////////////////////////////////////////////////////////////////
  67. // CIASVendorSpecificConformsNo dialog
  68. class CIASVendorSpecificConformsNo: public CHelpDialog
  69. {
  70. DECLARE_DYNCREATE(CIASVendorSpecificConformsNo)
  71. // Construction
  72. public:
  73. CIASVendorSpecificConformsNo();
  74. ~CIASVendorSpecificConformsNo();
  75. // Dialog Data
  76. //{{AFX_DATA(CIASVendorSpecificConformsNo)
  77. enum { IDD = IDD_IAS_VENDORSPEC_ATTR_CONFORMS_NO };
  78. ::CString m_strDispValue;
  79. //}}AFX_DATA
  80. // Overrides
  81. // ClassWizard generate virtual function overrides
  82. //{{AFX_VIRTUAL(CIASVendorSpecificConformsNo)
  83. protected:
  84. virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
  85. //}}AFX_VIRTUAL
  86. // Implementation
  87. private:
  88. BOOL m_fInitializing;
  89. protected:
  90. // Generated message map functions
  91. //{{AFX_MSG(CIASVendorSpecificConformsNo)
  92. virtual BOOL OnInitDialog();
  93. // afx_msg void OnContextMenu(CWnd* pWnd, ::CPoint point);
  94. // afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
  95. //}}AFX_MSG
  96. DECLARE_MESSAGE_MAP()
  97. };
  98. //////////////////////////////////////////////////////////////////////////////
  99. // Implementation of the CIASPgVendorSpecAttr page.
  100. IMPLEMENT_DYNCREATE(CIASPgVendorSpecAttr, CHelpDialog)
  101. BEGIN_MESSAGE_MAP(CIASPgVendorSpecAttr, CHelpDialog)
  102. //{{AFX_MSG_MAP(CIASPgVendorSpecAttr)
  103. ON_BN_CLICKED(IDC_IAS_RADIO_HEX, OnRadioHex)
  104. ON_BN_CLICKED(IDC_IAS_RADIO_RADIUS, OnRadioRadius)
  105. ON_BN_CLICKED(IDC_RADIO_SELECTFROMLIST, OnRadioSelectFromList)
  106. ON_BN_CLICKED(IDC_RADIO_ENTERVERDORID, OnRadioEnterVendorId)
  107. ON_BN_CLICKED(IDC_IAS_BUTTON_CONFIGURE, OnButtonConfigure)
  108. ON_CBN_SELCHANGE(IDC_IAS_COMBO_VENDORID, OnVendorIdListSelChange)
  109. // ON_WM_CONTEXTMENU()
  110. // ON_WM_HELPINFO()
  111. //}}AFX_MSG_MAP
  112. END_MESSAGE_MAP()
  113. //////////////////////////////////////////////////////////////////////////////
  114. /*++
  115. CIASPgVendorSpecAttr::CIASPgVendorSpecAttr
  116. Constructor
  117. --*/
  118. //////////////////////////////////////////////////////////////////////////////
  119. CIASPgVendorSpecAttr::CIASPgVendorSpecAttr() : CHelpDialog(CIASPgVendorSpecAttr::IDD)
  120. {
  121. TRACE(_T("CIASPgVendorSpecAttr::CIASPgVendorSpecAttr\n"));
  122. m_strDispValue = _T("");
  123. //{{AFX_DATA_INIT(CIASPgVendorSpecAttr)
  124. m_strName = _T("");
  125. m_dType = 0;
  126. m_dFormat = -1;
  127. m_dVendorIndex = -1;
  128. //}}AFX_DATA_INIT
  129. m_bVendorIndexAsID = FALSE;
  130. m_fInitializing = TRUE;
  131. }
  132. //////////////////////////////////////////////////////////////////////////////
  133. /*++
  134. CIASPgVendorSpecAttr::~CIASPgVendorSpecAttr
  135. --*/
  136. //////////////////////////////////////////////////////////////////////////////
  137. CIASPgVendorSpecAttr::~CIASPgVendorSpecAttr()
  138. {
  139. TRACE(_T("CIASPgVendorSpecAttr::~CIASPgVendorSpecAttr\n"));
  140. }
  141. //////////////////////////////////////////////////////////////////////////////
  142. /*++
  143. CIASPgVendorSpecAttr::DoDataExchange
  144. --*/
  145. //////////////////////////////////////////////////////////////////////////////
  146. void CIASPgVendorSpecAttr::DoDataExchange(CDataExchange* pDX)
  147. {
  148. TRACE(_T("CIASPgVendorSpecAttr::DoDataExchange\n"));
  149. CHelpDialog::DoDataExchange(pDX);
  150. //{{AFX_DATA_MAP(CIASPgVendorSpecAttr)
  151. DDX_Text(pDX, IDC_IAS_STATIC_ATTRNAME, m_strName);
  152. if (m_bVendorIndexAsID)
  153. {
  154. DDX_Text(pDX, IDC_EDIT_VENDORID, m_dVendorIndex);
  155. }
  156. //}}AFX_DATA_MAP
  157. if ( m_fInitializing )
  158. {
  159. //
  160. // set the initializing flag -- we shouldn't call custom data verification
  161. // routine when initializing, because otherwise we will report an error
  162. // for an attribute whose value has never been initialized
  163. //
  164. m_fInitializing = FALSE;
  165. }
  166. else
  167. {
  168. // Even though we validate data in the sub-dialogs,
  169. // we need to re-validate it here to make sure, e.g.
  170. // the user doesn't leave this dialog after setting
  171. // a value with the Non-conformant (hex) editor but then
  172. // switch the radio button to be conformant with a
  173. // decimal format type.
  174. // ISSUE: It would be nice if the error messages from the
  175. // validation routines below were a little more sensitive
  176. // to our current context and perhaps mentioned
  177. // something to the effect that the user should
  178. // click the "Configure Attribute..." button.
  179. if ( m_fNonRFC )
  180. {
  181. // hexadecimal string
  182. if(!m_strDispValue.IsEmpty())
  183. DDV_VSA_HexString(pDX, m_strDispValue);
  184. }
  185. else
  186. {
  187. // RFC compatible format -- check data validation.
  188. switch ( m_dFormat )
  189. {
  190. case 1: // decimal integer
  191. {
  192. if(!m_strDispValue.IsEmpty())
  193. DDV_Unsigned_IntegerStr(pDX, m_strDispValue);
  194. }
  195. break;
  196. case 2: // hexadecimal string
  197. {
  198. if(!m_strDispValue.IsEmpty())
  199. DDV_VSA_HexString(pDX, m_strDispValue);
  200. }
  201. break;
  202. default: // no error checking for other case
  203. break;
  204. } // switch
  205. } // else
  206. } // else
  207. }
  208. /////////////////////////////////////////////////////////////////////////////
  209. // CIASPgVendorSpecAttr message handlers
  210. //////////////////////////////////////////////////////////////////////////////
  211. /*++
  212. CIASPgVendorSpecAttr::OnInitDialog
  213. --*/
  214. //////////////////////////////////////////////////////////////////////////////
  215. BOOL CIASPgVendorSpecAttr::OnInitDialog()
  216. {
  217. TRACE(_T("CIASPgVendorSpecAttr::OnInitDialog\n"));
  218. // Initialize the vendor id combo box.
  219. CComboBox *pVendorBox = (CComboBox *) GetDlgItem(IDC_IAS_COMBO_VENDORID);
  220. CEdit* pVendorIdEdit = (CEdit*) GetDlgItem(IDC_EDIT_VENDORID);
  221. _ASSERTE( pVendorBox != NULL );
  222. _ASSERTE( pVendorIdEdit != NULL );
  223. // determine if to use edit box or list
  224. if (m_bVendorIndexAsID)
  225. {
  226. CheckDlgButton(IDC_RADIO_SELECTFROMLIST, 0); // uncheck the RADIUS radio button
  227. pVendorBox->EnableWindow(0);
  228. CheckDlgButton(IDC_RADIO_ENTERVERDORID, 1); // check
  229. pVendorIdEdit->EnableWindow(1);
  230. }
  231. else
  232. {
  233. CheckDlgButton(IDC_RADIO_SELECTFROMLIST, 1); // check the RADIUS radio button
  234. pVendorBox->EnableWindow(1);
  235. CheckDlgButton(IDC_RADIO_ENTERVERDORID, 0); // uncheck
  236. pVendorIdEdit->EnableWindow(0);
  237. }
  238. CHelpDialog::OnInitDialog();
  239. CComPtr<IIASNASVendors> spIASNASVendors;
  240. HRESULT hrTemp = CoCreateInstance( CLSID_IASNASVendors, NULL, CLSCTX_INPROC_SERVER, IID_IIASNASVendors, (LPVOID *) &spIASNASVendors );
  241. if( SUCCEEDED(hrTemp) )
  242. {
  243. LONG lSize;
  244. hrTemp = spIASNASVendors->get_Size( &lSize );
  245. if( SUCCEEDED(hrTemp) )
  246. {
  247. for ( LONG lIndex = 0; lIndex < lSize ; ++lIndex )
  248. {
  249. CComBSTR bstrVendorName;
  250. hrTemp = spIASNASVendors->get_VendorName( lIndex, &bstrVendorName );
  251. // Note: If vendor information fails us, we'll put a blank string.
  252. int iComboIndex = pVendorBox->AddString( bstrVendorName );
  253. if(iComboIndex != CB_ERR)
  254. {
  255. pVendorBox->SetItemData(iComboIndex, lIndex);
  256. // if selected
  257. if(!m_bVendorIndexAsID && m_dVendorIndex == lIndex)
  258. pVendorBox->SetCurSel(iComboIndex);
  259. }
  260. }
  261. }
  262. }
  263. if (m_fNonRFC)
  264. {
  265. CheckDlgButton(IDC_IAS_RADIO_RADIUS, 0); // uncheck the RADIUS radio button
  266. CheckDlgButton(IDC_IAS_RADIO_HEX, 1); // check the non-rfc button
  267. }
  268. else
  269. {
  270. CheckDlgButton(IDC_IAS_RADIO_RADIUS, 1); // uncheck the RADIUS radio button
  271. CheckDlgButton(IDC_IAS_RADIO_HEX, 0); // check the non-rfc button
  272. }
  273. return TRUE; // return TRUE unless you set the focus to a control
  274. // EXCEPTION: OCX Property Pages should return FALSE
  275. }
  276. //////////////////////////////////////////////////////////////////////////////
  277. /*++
  278. CIASPgVendorSpecAttr::OnRadioSelectFromList
  279. --*/
  280. //////////////////////////////////////////////////////////////////////////////
  281. void CIASPgVendorSpecAttr::OnRadioSelectFromList()
  282. {
  283. TRACE(_T("CIASPgVendorSpecAttr::OnRadioSelectFromList\n"));
  284. if ( IsDlgButtonChecked(IDC_RADIO_SELECTFROMLIST) )
  285. {
  286. m_bVendorIndexAsID = FALSE;
  287. }
  288. // Initialize the vendor id combo box.
  289. CComboBox *pVendorBox = (CComboBox *) GetDlgItem(IDC_IAS_COMBO_VENDORID);
  290. CEdit* pVendorIdEdit = (CEdit*) GetDlgItem(IDC_EDIT_VENDORID);
  291. _ASSERTE( pVendorBox != NULL );
  292. _ASSERTE( pVendorIdEdit != NULL );
  293. // determine if to use edit box or list
  294. if (m_bVendorIndexAsID)
  295. {
  296. pVendorBox->EnableWindow(0);
  297. pVendorIdEdit->EnableWindow(1);
  298. }
  299. else
  300. {
  301. pVendorBox->EnableWindow(1);
  302. pVendorIdEdit->EnableWindow(0);
  303. }
  304. }
  305. // selection change ... with combo box
  306. void CIASPgVendorSpecAttr::OnVendorIdListSelChange()
  307. {
  308. if(m_bVendorIndexAsID)
  309. {
  310. // doesn't matter
  311. }
  312. else
  313. {
  314. CComboBox *pVendorBox = (CComboBox *) GetDlgItem(IDC_IAS_COMBO_VENDORID);
  315. _ASSERTE(pVendorBox != NULL);
  316. int iSel = pVendorBox->GetCurSel();
  317. if(iSel != CB_ERR)
  318. {
  319. m_dVendorIndex = pVendorBox->GetItemData(iSel);
  320. }
  321. }
  322. }
  323. //////////////////////////////////////////////////////////////////////////////
  324. /*++
  325. CIASPgVendorSpecAttr::OnRadioEnterVendorId
  326. --*/
  327. //////////////////////////////////////////////////////////////////////////////
  328. void CIASPgVendorSpecAttr::OnRadioEnterVendorId()
  329. {
  330. TRACE(_T("CIASPgVendorSpecAttr::OnRadioEnterVendorId\n"));
  331. if ( IsDlgButtonChecked(IDC_RADIO_ENTERVERDORID) )
  332. {
  333. m_bVendorIndexAsID = TRUE;
  334. }
  335. // Initialize the vendor id combo box.
  336. CComboBox *pVendorBox = (CComboBox *) GetDlgItem(IDC_IAS_COMBO_VENDORID);
  337. CEdit* pVendorIdEdit = (CEdit*) GetDlgItem(IDC_EDIT_VENDORID);
  338. _ASSERTE( pVendorBox != NULL );
  339. _ASSERTE( pVendorIdEdit != NULL );
  340. // determine if to use edit box or list
  341. if (m_bVendorIndexAsID)
  342. {
  343. pVendorBox->EnableWindow(0);
  344. pVendorIdEdit->EnableWindow(1);
  345. }
  346. else
  347. {
  348. pVendorBox->EnableWindow(1);
  349. pVendorIdEdit->EnableWindow(0);
  350. }
  351. }
  352. //////////////////////////////////////////////////////////////////////////////
  353. /*++
  354. CIASPgVendorSpecAttr::OnRadioHex
  355. --*/
  356. //////////////////////////////////////////////////////////////////////////////
  357. void CIASPgVendorSpecAttr::OnRadioHex()
  358. {
  359. TRACE(_T("CIASPgVendorSpecAttr::OnRadioHex\n"));
  360. if ( IsDlgButtonChecked(IDC_IAS_RADIO_HEX) )
  361. {
  362. m_fNonRFC = TRUE;
  363. }
  364. }
  365. //////////////////////////////////////////////////////////////////////////////
  366. /*++
  367. CIASPgVendorSpecAttr::OnRadioRadius
  368. --*/
  369. //////////////////////////////////////////////////////////////////////////////
  370. void CIASPgVendorSpecAttr::OnRadioRadius()
  371. {
  372. TRACE(_T("CIASPgVendorSpecAttr::OnRadioRadius\n"));
  373. if ( IsDlgButtonChecked(IDC_IAS_RADIO_RADIUS) )
  374. {
  375. m_fNonRFC = FALSE;
  376. }
  377. }
  378. //////////////////////////////////////////////////////////////////////////////
  379. /*++
  380. CIASPgVendorSpecAttr::OnButtonConfigure
  381. --*/
  382. //////////////////////////////////////////////////////////////////////////////
  383. void CIASPgVendorSpecAttr::OnButtonConfigure()
  384. {
  385. TRACE_FUNCTION("CIASPgVendorSpecAttr::OnButtonConfigure");
  386. HRESULT hr;
  387. try
  388. {
  389. CHelpDialog * dialog = NULL;
  390. if( m_fNonRFC )
  391. {
  392. CIASVendorSpecificConformsNo dialog;
  393. // Initialize the sub-dialog.
  394. dialog.m_strDispValue = m_strDispValue;
  395. int iResult = dialog.DoModal();
  396. if (IDOK == iResult)
  397. {
  398. // Get data from sub-dialog and store values
  399. // to our own variables
  400. m_strDispValue = dialog.m_strDispValue;
  401. }
  402. else
  403. {
  404. }
  405. }
  406. else
  407. {
  408. CIASVendorSpecificConformsYes dialog;
  409. // Initialize the sub-dialog.
  410. dialog.m_strDispValue = m_strDispValue;
  411. dialog.m_dType = m_dType;
  412. dialog.m_dFormat = m_dFormat;
  413. int iResult = dialog.DoModal();
  414. if (IDOK == iResult)
  415. {
  416. // Get data from sub-dialog and store values
  417. // to our own variables
  418. m_strDispValue = dialog.m_strDispValue;
  419. m_dType = dialog.m_dType;
  420. m_dFormat = dialog.m_dFormat;
  421. }
  422. else
  423. {
  424. }
  425. }
  426. }
  427. catch(...)
  428. {
  429. // Error message
  430. }
  431. }
  432. //////////////////////////////////////////////////////////////////////////////
  433. // Implementation of classes used only in this file.
  434. // Implementation for the page we pop up when the user chooses an attribute which conforms.
  435. IMPLEMENT_DYNCREATE(CIASVendorSpecificConformsYes, CHelpDialog)
  436. BEGIN_MESSAGE_MAP(CIASVendorSpecificConformsYes, CHelpDialog)
  437. //{{AFX_MSG_MAP(CIASVendorSpecificConformsYes)
  438. // ON_WM_CONTEXTMENU()
  439. // ON_WM_HELPINFO()
  440. ON_CBN_SELCHANGE(IDC_IAS_COMBO_VENDORSPEC_FORMAT, OnSelchangeFormat)
  441. //}}AFX_MSG_MAP
  442. END_MESSAGE_MAP()
  443. //////////////////////////////////////////////////////////////////////////////
  444. /*++
  445. CIASVendorSpecificConformsYes::CIASVendorSpecificConformsYes
  446. Constructor
  447. --*/
  448. //////////////////////////////////////////////////////////////////////////////
  449. CIASVendorSpecificConformsYes::CIASVendorSpecificConformsYes() : CHelpDialog(CIASVendorSpecificConformsYes::IDD)
  450. {
  451. TRACE(_T("CIASVendorSpecificConformsYes::CIASVendorSpecificConformsYes\n"));
  452. //{{AFX_DATA_INIT(CIASVendorSpecificConformsYes)
  453. m_strDispValue = _T("");
  454. m_dType = 0;
  455. m_dFormat = -1;
  456. //}}AFX_DATA_INIT
  457. m_fInitializing = TRUE;
  458. }
  459. //////////////////////////////////////////////////////////////////////////////
  460. /*++
  461. CIASVendorSpecificConformsYes::~CIASVendorSpecificConformsYes
  462. --*/
  463. //////////////////////////////////////////////////////////////////////////////
  464. CIASVendorSpecificConformsYes::~CIASVendorSpecificConformsYes()
  465. {
  466. TRACE(_T("CIASVendorSpecificConformsYes::~CIASVendorSpecificConformsYes\n"));
  467. }
  468. //////////////////////////////////////////////////////////////////////////////
  469. /*++
  470. CIASVendorSpecificConformsYes::DoDataExchange
  471. --*/
  472. //////////////////////////////////////////////////////////////////////////////
  473. void CIASVendorSpecificConformsYes::DoDataExchange(CDataExchange* pDX)
  474. {
  475. TRACE(_T("CIASVendorSpecificConformsYes::DoDataExchange\n"));
  476. USES_CONVERSION;
  477. CHelpDialog::DoDataExchange(pDX);
  478. //{{AFX_DATA_MAP(CIASVendorSpecificConformsYes)
  479. DDX_Text(pDX, IDC_IAS_EDIT_VENDORSPEC_VALUE, m_strDispValue);
  480. DDV_MaxChars(pDX, m_strDispValue, 246);
  481. DDX_Text(pDX, IDC_IAS_EDIT_VENDORSPEC_TYPE, m_dType);
  482. DDV_MinMaxInt(pDX, m_dType, 0, 255);
  483. DDX_CBIndex(pDX, IDC_IAS_COMBO_VENDORSPEC_FORMAT, m_dFormat);
  484. //}}AFX_DATA_MAP
  485. if(m_dFormat == 3) // ipaddress
  486. {
  487. DWORD IpAddr = 0;
  488. if(pDX->m_bSaveAndValidate) // save data to this class
  489. {
  490. // ip adress control
  491. if (0 != SendDlgItemMessage(IDC_IAS_IPADDR_VENDORSPEC_VALUE, IPM_GETADDRESS, 0, (LPARAM)&IpAddr))
  492. {
  493. in_addr Tmp_ipAddr;
  494. Tmp_ipAddr.s_addr = htonl(IpAddr);
  495. m_strDispValue = inet_ntoa(Tmp_ipAddr);
  496. }else // no input from USer,
  497. m_strDispValue = _T("");
  498. // write to the string
  499. }
  500. else // put to dialog
  501. {
  502. // ip adress control
  503. if(!m_strDispValue.IsEmpty())
  504. {
  505. IpAddr = inet_addr(T2A(m_strDispValue));
  506. IpAddr = ntohl(IpAddr);
  507. SendDlgItemMessage(IDC_IAS_IPADDR_VENDORSPEC_VALUE, IPM_SETADDRESS, 0, IpAddr);
  508. }
  509. }
  510. }
  511. if ( m_fInitializing )
  512. {
  513. //
  514. // set the initializing flag -- we shouldn't call custom data verification
  515. // routine when initializing, because otherwise we will report an error
  516. // for an attribute whose value has never been initialized
  517. //
  518. m_fInitializing = FALSE;
  519. }
  520. else
  521. {
  522. // RFC compatible format -- check data validation.
  523. switch ( m_dFormat )
  524. {
  525. case 1: // decimal integer
  526. {
  527. if(!m_strDispValue.IsEmpty())
  528. DDV_Unsigned_IntegerStr(pDX, m_strDispValue);
  529. }
  530. break;
  531. case 2: // hexadecimal string
  532. {
  533. if(!m_strDispValue.IsEmpty())
  534. DDV_VSA_HexString(pDX, m_strDispValue);
  535. }
  536. break;
  537. case 3: // ipaddress IP address : added F; 211265
  538. default: // no error checking for other case
  539. break;
  540. } // switch
  541. } // else
  542. }
  543. /////////////////////////////////////////////////////////////////////////////
  544. // CIASVendorSpecificConformsYes message handlers
  545. //////////////////////////////////////////////////////////////////////////////
  546. /*++
  547. CIASVendorSpecificConformsYes::OnInitDialog
  548. --*/
  549. //////////////////////////////////////////////////////////////////////////////
  550. BOOL CIASVendorSpecificConformsYes::OnInitDialog()
  551. {
  552. TRACE(_T("CIASVendorSpecificConformsYes::OnInitDialog\n"));
  553. CHelpDialog::OnInitDialog();
  554. int iIndex;
  555. // initialize the format combo box
  556. CComboBox *pFormatBox = (CComboBox *) GetDlgItem(IDC_IAS_COMBO_VENDORSPEC_FORMAT);
  557. _ASSERTE( pFormatBox != NULL );
  558. ::CString strFormatStr;
  559. strFormatStr.LoadString(IDS_IAS_VSA_FORMAT_STR);
  560. pFormatBox ->AddString((LPCTSTR)strFormatStr);
  561. strFormatStr.LoadString(IDS_IAS_VSA_FORMAT_DEC);
  562. pFormatBox ->AddString((LPCTSTR)strFormatStr);
  563. strFormatStr.LoadString(IDS_IAS_VSA_FORMAT_HEX);
  564. pFormatBox ->AddString((LPCTSTR)strFormatStr);
  565. strFormatStr.LoadString(IDS_IAS_VSA_FORMAT_INetAddr);
  566. pFormatBox ->AddString((LPCTSTR)strFormatStr);
  567. pFormatBox->SetCurSel(m_dFormat);
  568. OnSelchangeFormat();
  569. return TRUE; // return TRUE unless you set the focus to a control
  570. // EXCEPTION: OCX Property Pages should return FALSE
  571. }
  572. void CIASVendorSpecificConformsYes::OnSelchangeFormat()
  573. {
  574. // TODO: Add your control notification handler code here
  575. CComboBox *pFormatBox = (CComboBox *) GetDlgItem(IDC_IAS_COMBO_VENDORSPEC_FORMAT);
  576. int format = pFormatBox->GetCurSel();
  577. if(format == 3) // ipaddress
  578. {
  579. GetDlgItem(IDC_IAS_EDIT_VENDORSPEC_VALUE)->ShowWindow(SW_HIDE);
  580. GetDlgItem(IDC_IAS_IPADDR_VENDORSPEC_VALUE)->ShowWindow(SW_SHOW);
  581. }
  582. else
  583. {
  584. GetDlgItem(IDC_IAS_EDIT_VENDORSPEC_VALUE)->ShowWindow(SW_SHOW);
  585. GetDlgItem(IDC_IAS_IPADDR_VENDORSPEC_VALUE)->ShowWindow(SW_HIDE);
  586. }
  587. }
  588. // Now the implementation for the page we pop up when the user chooses an attribute
  589. // does not conform.
  590. IMPLEMENT_DYNCREATE(CIASVendorSpecificConformsNo, CHelpDialog)
  591. BEGIN_MESSAGE_MAP(CIASVendorSpecificConformsNo, CHelpDialog)
  592. //{{AFX_MSG_MAP(CIASVendorSpecificConformsNo)
  593. // ON_WM_CONTEXTMENU()
  594. // ON_WM_HELPINFO()
  595. //}}AFX_MSG_MAP
  596. END_MESSAGE_MAP()
  597. //////////////////////////////////////////////////////////////////////////////
  598. /*++
  599. CIASVendorSpecificConformsNo::CIASVendorSpecificConformsNo
  600. Constructor
  601. --*/
  602. //////////////////////////////////////////////////////////////////////////////
  603. CIASVendorSpecificConformsNo::CIASVendorSpecificConformsNo() : CHelpDialog(CIASVendorSpecificConformsNo::IDD)
  604. {
  605. TRACE(_T("CIASVendorSpecificConformsNo::CIASVendorSpecificConformsNo\n"));
  606. //{{AFX_DATA_INIT(CIASVendorSpecificConformsNo)
  607. m_strDispValue = _T("");
  608. //}}AFX_DATA_INIT
  609. m_fInitializing = TRUE;
  610. }
  611. //////////////////////////////////////////////////////////////////////////////
  612. /*++
  613. CIASVendorSpecificConformsNo::~CIASVendorSpecificConformsNo
  614. --*/
  615. //////////////////////////////////////////////////////////////////////////////
  616. CIASVendorSpecificConformsNo::~CIASVendorSpecificConformsNo()
  617. {
  618. TRACE(_T("CIASVendorSpecificConformsNo::~CIASVendorSpecificConformsNo\n"));
  619. }
  620. //////////////////////////////////////////////////////////////////////////////
  621. /*++
  622. CIASVendorSpecificConformsNo::DoDataExchange
  623. --*/
  624. //////////////////////////////////////////////////////////////////////////////
  625. void CIASVendorSpecificConformsNo::DoDataExchange(CDataExchange* pDX)
  626. {
  627. TRACE(_T("CIASVendorSpecificConformsNo::DoDataExchange\n"));
  628. CHelpDialog::DoDataExchange(pDX);
  629. //{{AFX_DATA_MAP(CIASVendorSpecificConformsNo)
  630. DDX_Text(pDX, IDC_IAS_EDIT_VENDORSPEC_VALUE, m_strDispValue);
  631. DDV_MaxChars(pDX, m_strDispValue, 246);
  632. //}}AFX_DATA_MAP
  633. if ( m_fInitializing )
  634. {
  635. //
  636. // set the initializing flag -- we shouldn't call custom data verification
  637. // routine when initializing, because otherwise we will report an error
  638. // for an attribute whose value has never been initialized
  639. //
  640. m_fInitializing = FALSE;
  641. }
  642. else
  643. {
  644. // hexadecimal string
  645. if(!m_strDispValue.IsEmpty())
  646. DDV_VSA_HexString(pDX, m_strDispValue);
  647. }
  648. }
  649. /////////////////////////////////////////////////////////////////////////////
  650. // CIASVendorSpecificConformsNo message handlers
  651. //////////////////////////////////////////////////////////////////////////////
  652. /*++
  653. CIASVendorSpecificConformsNo::OnInitDialog
  654. --*/
  655. //////////////////////////////////////////////////////////////////////////////
  656. BOOL CIASVendorSpecificConformsNo::OnInitDialog()
  657. {
  658. TRACE(_T("CIASVendorSpecificConformsNo::OnInitDialog\n"));
  659. CHelpDialog::OnInitDialog();
  660. int iIndex;
  661. return TRUE; // return TRUE unless you set the focus to a control
  662. // EXCEPTION: OCX Property Pages should return FALSE
  663. }