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.

104 lines
2.2 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1998 - 1999
  6. //
  7. // File: proppage.h
  8. //
  9. //--------------------------------------------------------------------------
  10. #ifndef _PROPPAGE_H
  11. #define _PROPPAGE_H
  12. #include "afxdlgs.h"
  13. #define MAX_UPN_SUFFIX_LEN 256
  14. ////////////////////////////////////////////////////////////////////////////////
  15. // CUpnSuffixPropertyPage
  16. class CUpnSuffixListBox : public CListBox
  17. {
  18. public:
  19. int AddItem(LPCTSTR lpszText)
  20. { return AddString(lpszText);}
  21. void GetItem(int iItem, CString& szText)
  22. { GetText(iItem, szText);}
  23. BOOL DeleteItem(int iItem)
  24. { return DeleteString(iItem) != LB_ERR;}
  25. int GetSelection()
  26. { return GetCurSel();}
  27. BOOL SetSelection(int nSel)
  28. { return SetCurSel(nSel) != LB_ERR; }
  29. void UpdateHorizontalExtent()
  30. {
  31. int nHorzExtent = 0;
  32. CClientDC dc(this);
  33. int nItems = GetCount();
  34. for (int i=0; i < nItems; i++)
  35. {
  36. TEXTMETRIC tm;
  37. VERIFY(dc.GetTextMetrics(&tm));
  38. CString szBuffer;
  39. GetText(i, szBuffer);
  40. CSize ext = dc.GetTextExtent(szBuffer,szBuffer.GetLength());
  41. nHorzExtent = max(ext.cx ,nHorzExtent);
  42. }
  43. SetHorizontalExtent(nHorzExtent);
  44. }
  45. };
  46. class CUpnSuffixPropertyPage : public CPropertyPage
  47. {
  48. public:
  49. CUpnSuffixPropertyPage();
  50. virtual ~CUpnSuffixPropertyPage();
  51. virtual BOOL OnInitDialog();
  52. virtual BOOL OnApply();
  53. private:
  54. afx_msg void OnAddButton();
  55. afx_msg void OnDeleteButton();
  56. afx_msg void OnEditChange();
  57. afx_msg BOOL OnHelpInfo(HELPINFO* pHelpInfo);
  58. private:
  59. void _SetDirty(BOOL bDirty)
  60. {
  61. SetModified(bDirty);
  62. m_bDirty = bDirty;
  63. }
  64. BOOL _IsDirty() { return m_bDirty;}
  65. HRESULT _GetPartitionsContainer();
  66. void _Read();
  67. HRESULT _Write();
  68. BOOL m_bDirty;
  69. IDirectoryObject* m_pIADsPartitionsCont;
  70. CUpnSuffixListBox m_listBox;
  71. CString m_szEditText;
  72. UINT m_nPreviousDefaultButtonID;
  73. // hook up the callback for C++ object destruction
  74. LPFNPSPCALLBACK m_pfnOldPropCallback;
  75. static UINT CALLBACK PropSheetPageProc(
  76. HWND hwnd,
  77. UINT uMsg,
  78. LPPROPSHEETPAGE ppsp);
  79. DECLARE_MESSAGE_MAP()
  80. };
  81. #endif // _PROPPAGE_H