home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / msdn_vcb / samples / vc98 / sdk / winbase / cluster / smbsmp / smbsmpex / resprop.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-07-29  |  7.0 KB  |  259 lines

  1. /////////////////////////////////////////////////////////////////////////////
  2. //
  3. //    Copyright (c) 1997 <company name>
  4. //
  5. //    Module Name:
  6. //        ResProp.cpp
  7. //
  8. //    Abstract:
  9. //        Implementation of the resource extension property page classes.
  10. //
  11. //    Author:
  12. //        <name> (<e-mail name>) Mmmm DD, 1997
  13. //
  14. //    Revision History:
  15. //
  16. //    Notes:
  17. //
  18. /////////////////////////////////////////////////////////////////////////////
  19.  
  20. #include "stdafx.h"
  21. #include "SmbSmpEx.h"
  22. #include "ResProp.h"
  23. #include "ExtObj.h"
  24. #include "DDxDDv.h"
  25.  
  26. #ifdef _DEBUG
  27. #define new DEBUG_NEW
  28. #undef THIS_FILE
  29. static char THIS_FILE[] = __FILE__;
  30. #endif
  31.  
  32. /////////////////////////////////////////////////////////////////////////////
  33. // CSmbSmpParamsPage property page
  34. /////////////////////////////////////////////////////////////////////////////
  35.  
  36. IMPLEMENT_DYNCREATE(CSmbSmpParamsPage, CBasePropertyPage)
  37.  
  38. /////////////////////////////////////////////////////////////////////////////
  39. // Message Maps
  40.  
  41. BEGIN_MESSAGE_MAP(CSmbSmpParamsPage, CBasePropertyPage)
  42.     //{{AFX_MSG_MAP(CSmbSmpParamsPage)
  43.     ON_EN_CHANGE(IDC_PP_SMBSMP_SHARENAME, OnChangeRequiredField)
  44.     ON_EN_CHANGE(IDC_PP_SMBSMP_PATH, OnChangeRequiredField)
  45.     //}}AFX_MSG_MAP
  46.     // TODO: Modify the following lines to represent the data displayed on this page.
  47.     ON_EN_CHANGE(IDC_PP_SMBSMP_SHARENAME, CBasePropertyPage::OnChangeCtrl)
  48.     ON_EN_CHANGE(IDC_PP_SMBSMP_PATH, CBasePropertyPage::OnChangeCtrl)
  49.     ON_EN_CHANGE(IDC_PP_SMBSMP_REMARK, CBasePropertyPage::OnChangeCtrl)
  50. END_MESSAGE_MAP()
  51.  
  52. /////////////////////////////////////////////////////////////////////////////
  53. //++
  54. //
  55. //    CSmbSmpParamsPage::CSmbSmpParamsPage
  56. //
  57. //    Routine Description:
  58. //        Default constructor.
  59. //
  60. //    Arguments:
  61. //        None.
  62. //
  63. //    Return Value:
  64. //        None.
  65. //
  66. //--
  67. /////////////////////////////////////////////////////////////////////////////
  68. CSmbSmpParamsPage::CSmbSmpParamsPage(void) : CBasePropertyPage(CSmbSmpParamsPage::IDD)
  69. {
  70.     // TODO: Modify the following lines to represent the data displayed on this page.
  71.     //{{AFX_DATA_INIT(CSmbSmpParamsPage)
  72.     m_strShareName = _T("");
  73.     m_strPath = _T("");
  74.     m_strRemark = _T("");
  75.     //}}AFX_DATA_INIT
  76.  
  77.     // Setup the property array.
  78.     {
  79.         m_rgProps[epropShareName].Set(REGPARAM_SMBSMP_SHARENAME, m_strShareName, m_strPrevShareName);
  80.         m_rgProps[epropPath].Set(REGPARAM_SMBSMP_PATH, m_strPath, m_strPrevPath);
  81.         m_rgProps[epropRemark].Set(REGPARAM_SMBSMP_REMARK, m_strRemark, m_strPrevRemark);
  82.     }  // Setup the property array
  83.  
  84.     m_iddPropertyPage = IDD_PP_SMBSMP_PARAMETERS;
  85.     m_iddWizardPage = IDD_WIZ_SMBSMP_PARAMETERS;
  86.  
  87. }  //*** CSmbSmpParamsPage::CSmbSmpParamsPage()
  88.  
  89. /////////////////////////////////////////////////////////////////////////////
  90. //++
  91. //
  92. //    CSmbSmpParamsPage::DoDataExchange
  93. //
  94. //    Routine Description:
  95. //        Do data exchange between the dialog and the class.
  96. //
  97. //    Arguments:
  98. //        pDX        [IN OUT] Data exchange object 
  99. //
  100. //    Return Value:
  101. //        None.
  102. //
  103. //--
  104. /////////////////////////////////////////////////////////////////////////////
  105. void CSmbSmpParamsPage::DoDataExchange(CDataExchange * pDX)
  106. {
  107.     AFX_MANAGE_STATE(AfxGetStaticModuleState());
  108.  
  109.     // TODO: Modify the following lines to represent the data displayed on this page.
  110.     //{{AFX_DATA_MAP(CSmbSmpParamsPage)
  111.     DDX_Control(pDX, IDC_PP_SMBSMP_SHARENAME, m_editShareName);
  112.     DDX_Control(pDX, IDC_PP_SMBSMP_PATH, m_editPath);
  113.     DDX_Text(pDX, IDC_PP_SMBSMP_SHARENAME, m_strShareName);
  114.     DDX_Text(pDX, IDC_PP_SMBSMP_PATH, m_strPath);
  115.     DDX_Text(pDX, IDC_PP_SMBSMP_REMARK, m_strRemark);
  116.     //}}AFX_DATA_MAP
  117.  
  118.     // Handle numeric parameters.
  119.     // TODO: Change the last argument to TRUE if any of these are signed values.
  120.     if (!BBackPressed())
  121.     {
  122.     }  // if:  back button not pressed
  123.  
  124.     // TODO: Add any additional field validation here.
  125.     if (pDX->m_bSaveAndValidate)
  126.     {
  127.         // Make sure all required fields are present.
  128.         if (!BBackPressed())
  129.         {
  130.             DDV_RequiredText(pDX, IDC_PP_SMBSMP_SHARENAME, IDC_PP_SMBSMP_SHARENAME_LABEL, m_strShareName);
  131.             DDV_RequiredText(pDX, IDC_PP_SMBSMP_PATH, IDC_PP_SMBSMP_PATH_LABEL, m_strPath);
  132.         }  // if:  back button not pressed
  133.     }  // if:  saving data from dialog
  134.  
  135.     CBasePropertyPage::DoDataExchange(pDX);
  136.  
  137. }  //*** CSmbSmpParamsPage::DoDataExchange()
  138.  
  139. /////////////////////////////////////////////////////////////////////////////
  140. //++
  141. //
  142. //    CSmbSmpParamsPage::OnInitDialog
  143. //
  144. //    Routine Description:
  145. //        Handler for the WM_INITDIALOG message.
  146. //
  147. //    Arguments:
  148. //        None.
  149. //
  150. //    Return Value:
  151. //        TRUE        We need the focus to be set for us.
  152. //        FALSE        We already set the focus to the proper control.
  153. //
  154. //--
  155. /////////////////////////////////////////////////////////////////////////////
  156. BOOL CSmbSmpParamsPage::OnInitDialog(void)
  157. {
  158.     AFX_MANAGE_STATE(AfxGetStaticModuleState());
  159.  
  160.     CBasePropertyPage::OnInitDialog();
  161.  
  162.     // TODO:
  163.     // Limit the size of the text that can be entered in edit controls.
  164.  
  165.     return TRUE;    // return TRUE unless you set the focus to a control
  166.                     // EXCEPTION: OCX Property Pages should return FALSE
  167.  
  168. }  //*** CSmbSmpParamsPage::OnInitDialog()
  169.  
  170. /////////////////////////////////////////////////////////////////////////////
  171. //++
  172. //
  173. //    CSmbSmpParamsPage::OnSetActive
  174. //
  175. //    Routine Description:
  176. //        Handler for the PSN_SETACTIVE message.
  177. //
  178. //    Arguments:
  179. //        None.
  180. //
  181. //    Return Value:
  182. //        TRUE    Page successfully initialized.
  183. //        FALSE    Page not initialized.
  184. //
  185. //--
  186. /////////////////////////////////////////////////////////////////////////////
  187. BOOL CSmbSmpParamsPage::OnSetActive(void)
  188. {
  189.     AFX_MANAGE_STATE(AfxGetStaticModuleState());
  190.  
  191.     // Enable/disable the Next/Finish button.
  192.     if (BWizard())
  193.         EnableNext(BAllRequiredFieldsPresent());
  194.  
  195.     return CBasePropertyPage::OnSetActive();
  196.  
  197. }  //*** CSmbSmpParamsPage::OnSetActive()
  198.  
  199. /////////////////////////////////////////////////////////////////////////////
  200. //++
  201. //
  202. //    CSmbSmpParamsPage::OnChangeRequiredField
  203. //
  204. //    Routine Description:
  205. //        Handler for the EN_CHANGE message on the Share name or Path edit
  206. //        controls.
  207. //
  208. //    Arguments:
  209. //        None.
  210. //
  211. //    Return Value:
  212. //        None.
  213. //
  214. //--
  215. /////////////////////////////////////////////////////////////////////////////
  216. void CSmbSmpParamsPage::OnChangeRequiredField(void)
  217. {
  218.     AFX_MANAGE_STATE(AfxGetStaticModuleState());
  219.  
  220.     OnChangeCtrl();
  221.  
  222.     if (BWizard())
  223.         EnableNext(BAllRequiredFieldsPresent());
  224.  
  225. }  //*** CSmbSmpParamsPage::OnChangeRequiredField()
  226.  
  227. /////////////////////////////////////////////////////////////////////////////
  228. //++
  229. //
  230. //    CSmbSmpParamsPage::BAllRequiredFieldsPresent
  231. //
  232. //    Routine Description:
  233. //        Handler for the EN_CHANGE message on the Share name or Path edit
  234. //        controls.
  235. //
  236. //    Arguments:
  237. //        None.
  238. //
  239. //    Return Value:
  240. //        None.
  241. //
  242. //--
  243. /////////////////////////////////////////////////////////////////////////////
  244. BOOL CSmbSmpParamsPage::BAllRequiredFieldsPresent(void) const
  245. {
  246.     BOOL    bPresent;
  247.  
  248.     if (0
  249.         || (m_editShareName.GetWindowTextLength() == 0)
  250.         || (m_editPath.GetWindowTextLength() == 0)
  251.         )
  252.         bPresent = FALSE;
  253.     else
  254.         bPresent = TRUE;
  255.  
  256.     return bPresent;
  257.  
  258. }  //*** CSmbSmpParamsPage::BAllRequiredFieldsPresent()
  259.