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.

295 lines
7.6 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. //
  5. // Copyright (C) Microsoft Corporation, 1999 - 1999
  6. //
  7. // File: genpage.cpp
  8. //
  9. //--------------------------------------------------------------------------
  10. // genpage.cpp : implementation file
  11. //
  12. #include "stdafx.h"
  13. #include "Service.h"
  14. #include "csnapin.h"
  15. #include "resource.h"
  16. #include "afxdlgs.h"
  17. #include "genpage.h"
  18. #include "dataobj.h"
  19. #include "prsht.h"
  20. #ifdef _DEBUG
  21. #define new DEBUG_NEW
  22. #undef THIS_FILE
  23. static char THIS_FILE[] = __FILE__;
  24. #endif
  25. /////////////////////////////////////////////////////////////////////////////
  26. // CGeneralPage property page
  27. IMPLEMENT_DYNCREATE(CGeneralPage, CPropertyPage)
  28. CGeneralPage::CGeneralPage() : CPropertyPage(CGeneralPage::IDD)
  29. {
  30. //{{AFX_DATA_INIT(CGeneralPage)
  31. m_szName = _T("");
  32. //}}AFX_DATA_INIT
  33. m_hConsoleHandle = NULL;
  34. m_bUpdate = FALSE;
  35. }
  36. CGeneralPage::~CGeneralPage()
  37. {
  38. }
  39. void CGeneralPage::DoDataExchange(CDataExchange* pDX)
  40. {
  41. CPropertyPage::DoDataExchange(pDX);
  42. //{{AFX_DATA_MAP(CGeneralPage)
  43. DDX_Control(pDX, IDC_NEW_FOLDER, m_EditCtrl);
  44. DDX_Text(pDX, IDC_NEW_FOLDER, m_szName);
  45. DDV_MaxChars(pDX, m_szName, 64);
  46. //}}AFX_DATA_MAP
  47. }
  48. BEGIN_MESSAGE_MAP(CGeneralPage, CPropertyPage)
  49. //{{AFX_MSG_MAP(CGeneralPage)
  50. ON_WM_DESTROY()
  51. ON_EN_CHANGE(IDC_NEW_FOLDER, OnEditChange)
  52. //}}AFX_MSG_MAP
  53. END_MESSAGE_MAP()
  54. /////////////////////////////////////////////////////////////////////////////
  55. // CGeneralPage message handlers
  56. void CGeneralPage::OnDestroy()
  57. {
  58. // Note - This needs to be called only once.
  59. // If called more than once, it will gracefully return an error.
  60. MMCFreeNotifyHandle(m_hConsoleHandle);
  61. CPropertyPage::OnDestroy();
  62. // Delete the CGeneralPage object
  63. delete this;
  64. }
  65. void CGeneralPage::OnEditChange()
  66. {
  67. // Page is dirty, mark it.
  68. SetModified();
  69. m_bUpdate = TRUE;
  70. }
  71. BOOL CGeneralPage::OnApply()
  72. {
  73. if (m_bUpdate == TRUE)
  74. {
  75. USES_CONVERSION;
  76. // Simple string cookie, could be anything!
  77. LPWSTR lpString =
  78. reinterpret_cast<LPWSTR>(
  79. ::GlobalAlloc(GMEM_SHARE,
  80. (sizeof(wchar_t) *
  81. (m_szName.GetLength() + 1))
  82. ));
  83. wcscpy(lpString, T2COLE(m_szName));
  84. // Send a property change notify to the console
  85. MMCPropertyChangeNotify(m_hConsoleHandle, reinterpret_cast<LPARAM>(lpString));
  86. m_bUpdate = FALSE;
  87. }
  88. return CPropertyPage::OnApply();
  89. }
  90. /////////////////////////////////////////////////////////////////////////////
  91. // CExtensionPage property page
  92. IMPLEMENT_DYNCREATE(CExtensionPage, CPropertyPage)
  93. CExtensionPage::CExtensionPage() : CPropertyPage(CExtensionPage::IDD)
  94. {
  95. //{{AFX_DATA_INIT(CExtensionPage)
  96. m_szText = _T("");
  97. //}}AFX_DATA_INIT
  98. }
  99. CExtensionPage::~CExtensionPage()
  100. {
  101. }
  102. void CExtensionPage::DoDataExchange(CDataExchange* pDX)
  103. {
  104. CPropertyPage::DoDataExchange(pDX);
  105. //{{AFX_DATA_MAP(CExtensionPage)
  106. DDX_Control(pDX, IDC_EXT_TEXT, m_hTextCtrl);
  107. DDX_Text(pDX, IDC_EXT_TEXT, m_szText);
  108. //}}AFX_DATA_MAP
  109. }
  110. BEGIN_MESSAGE_MAP(CExtensionPage, CPropertyPage)
  111. //{{AFX_MSG_MAP(CExtensionPage)
  112. //}}AFX_MSG_MAP
  113. END_MESSAGE_MAP()
  114. /////////////////////////////////////////////////////////////////////////////
  115. // CExtensionPage message handlers
  116. BOOL CExtensionPage::OnInitDialog()
  117. {
  118. CPropertyPage::OnInitDialog();
  119. m_hTextCtrl.SetWindowText(m_szText);
  120. return TRUE; // return TRUE unless you set the focus to a control
  121. // EXCEPTION: OCX Property Pages should return FALSE
  122. }
  123. /////////////////////////////////////////////////////////////////////////////
  124. // CStartUpWizard property page
  125. // NOTICE: need to override this because CPropertyPage::AssertValid()
  126. // would otherwise assert
  127. IMPLEMENT_DYNCREATE(CBaseWizard, CPropertyPage)
  128. CBaseWizard::CBaseWizard(UINT id) : CPropertyPage(id)
  129. {
  130. // NOTICE: need to do this because MFC was compiled with NT 4.0
  131. // headers that had a different size
  132. ZeroMemory(&m_psp97, sizeof(PROPSHEETPAGE));
  133. memcpy(&m_psp97, &m_psp, m_psp.dwSize);
  134. m_psp97.dwSize = sizeof(PROPSHEETPAGE);
  135. }
  136. void CBaseWizard::OnDestroy()
  137. {
  138. CPropertyPage::OnDestroy();
  139. delete this;
  140. }
  141. BEGIN_MESSAGE_MAP(CBaseWizard, CPropertyPage)
  142. //{{AFX_MSG_MAP(CStartupWizard1)
  143. ON_WM_DESTROY()
  144. //}}AFX_MSG_MAP
  145. END_MESSAGE_MAP()
  146. IMPLEMENT_DYNCREATE(CStartUpWizard, CBaseWizard)
  147. CStartUpWizard::CStartUpWizard() : CBaseWizard(CStartUpWizard::IDD)
  148. {
  149. //{{AFX_DATA_INIT(CStartUpWizard)
  150. // NOTE: the ClassWizard will add member initialization here
  151. //}}AFX_DATA_INIT
  152. m_psp97.dwFlags |= PSP_HIDEHEADER;
  153. }
  154. CStartUpWizard::~CStartUpWizard()
  155. {
  156. }
  157. void CStartUpWizard::DoDataExchange(CDataExchange* pDX)
  158. {
  159. CPropertyPage::DoDataExchange(pDX);
  160. //{{AFX_DATA_MAP(CStartUpWizard)
  161. // NOTE: the ClassWizard will add DDX and DDV calls here
  162. //}}AFX_DATA_MAP
  163. }
  164. BEGIN_MESSAGE_MAP(CStartUpWizard, CBaseWizard)
  165. //{{AFX_MSG_MAP(CStartUpWizard)
  166. //}}AFX_MSG_MAP
  167. END_MESSAGE_MAP()
  168. /////////////////////////////////////////////////////////////////////////////
  169. // CStartUpWizard message handlers
  170. BOOL CStartUpWizard::OnInitDialog()
  171. {
  172. CPropertyPage::OnInitDialog();
  173. return TRUE; // return TRUE unless you set the focus to a control
  174. // EXCEPTION: OCX Property Pages should return FALSE
  175. }
  176. BOOL CStartUpWizard::OnSetActive()
  177. {
  178. // TODO: Add your specialized code here and/or call the base class
  179. // TODO: Add your specialized code here and/or call the base class
  180. HWND hwnd = GetParent()->m_hWnd;
  181. ::SendMessage(hwnd, PSM_SETWIZBUTTONS, 0, PSWIZB_NEXT);
  182. return CPropertyPage::OnSetActive();
  183. }
  184. /////////////////////////////////////////////////////////////////////////////
  185. // CStartupWizard1 property page
  186. IMPLEMENT_DYNCREATE(CStartupWizard1, CBaseWizard)
  187. CStartupWizard1::CStartupWizard1() : CBaseWizard(CStartupWizard1::IDD)
  188. {
  189. //{{AFX_DATA_INIT(CStartupWizard1)
  190. // NOTE: the ClassWizard will add member initialization here
  191. //}}AFX_DATA_INIT
  192. m_psp97.dwFlags |= PSP_USEHEADERTITLE | PSP_USEHEADERSUBTITLE;
  193. m_psp97.pszHeaderTitle = _T("This is the title line");
  194. m_psp97.pszHeaderSubTitle = _T("This is the sub-title line");
  195. }
  196. CStartupWizard1::~CStartupWizard1()
  197. {
  198. }
  199. void CStartupWizard1::DoDataExchange(CDataExchange* pDX)
  200. {
  201. CPropertyPage::DoDataExchange(pDX);
  202. //{{AFX_DATA_MAP(CStartupWizard1)
  203. // NOTE: the ClassWizard will add DDX and DDV calls here
  204. //}}AFX_DATA_MAP
  205. }
  206. BEGIN_MESSAGE_MAP(CStartupWizard1, CBaseWizard)
  207. //{{AFX_MSG_MAP(CStartupWizard1)
  208. //}}AFX_MSG_MAP
  209. END_MESSAGE_MAP()
  210. /////////////////////////////////////////////////////////////////////////////
  211. // CStartupWizard1 message handlers
  212. BOOL CStartupWizard1::OnInitDialog()
  213. {
  214. CPropertyPage::OnInitDialog();
  215. // TODO: Add extra initialization here
  216. return TRUE; // return TRUE unless you set the focus to a control
  217. // EXCEPTION: OCX Property Pages should return FALSE
  218. }
  219. BOOL CStartupWizard1::OnSetActive()
  220. {
  221. // TODO: Add your specialized code here and/or call the base class
  222. HWND hwnd = GetParent()->m_hWnd;
  223. ::SendMessage(hwnd, PSM_SETWIZBUTTONS, 0, PSWIZB_FINISH | PSWIZB_BACK);
  224. return CPropertyPage::OnSetActive();
  225. }