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.

104 lines
2.2 KiB

  1. // CalDlg.cpp : implementation file
  2. //
  3. #include "stdafx.h"
  4. #include "wabapp.h"
  5. #include "CalDlg.h"
  6. #include "Calendar.h"
  7. #ifdef _DEBUG
  8. #define new DEBUG_NEW
  9. #undef THIS_FILE
  10. static char THIS_FILE[] = __FILE__;
  11. #endif
  12. /////////////////////////////////////////////////////////////////////////////
  13. // CCalDlg dialog
  14. CCalDlg::CCalDlg(CWnd* pParent /*=NULL*/)
  15. : CDialog(CCalDlg::IDD, pParent)
  16. {
  17. //{{AFX_DATA_INIT(CCalDlg)
  18. // NOTE: the ClassWizard will add member initialization here
  19. //}}AFX_DATA_INIT
  20. }
  21. void CCalDlg::DoDataExchange(CDataExchange* pDX)
  22. {
  23. CDialog::DoDataExchange(pDX);
  24. //{{AFX_DATA_MAP(CCalDlg)
  25. // NOTE: the ClassWizard will add DDX and DDV calls here
  26. //}}AFX_DATA_MAP
  27. }
  28. void CCalDlg::SetItemName(CString szName)
  29. {
  30. CString s1("Select a birthday date for ");
  31. CString s2(szName);
  32. CString sz(s1 + s2);
  33. m_psz = new CString(sz);
  34. }
  35. void CCalDlg::SetDate(SYSTEMTIME st)
  36. {
  37. m_Day = (short) st.wDay;
  38. m_Month = (short) st.wMonth;
  39. m_Year = (short) st.wYear;
  40. }
  41. void CCalDlg::GetDate(SYSTEMTIME * lpst)
  42. {
  43. lpst->wDay = m_Day;
  44. lpst->wMonth = m_Month;
  45. lpst->wYear = m_Year;
  46. }
  47. BEGIN_MESSAGE_MAP(CCalDlg, CDialog)
  48. //{{AFX_MSG_MAP(CCalDlg)
  49. ON_WM_DESTROY()
  50. //}}AFX_MSG_MAP
  51. END_MESSAGE_MAP()
  52. /////////////////////////////////////////////////////////////////////////////
  53. // CCalDlg message handlers
  54. BOOL CCalDlg::OnInitDialog()
  55. {
  56. CDialog::OnInitDialog();
  57. CStatic * pStatic = (CStatic *) GetDlgItem(IDC_STATIC_FRAME);
  58. pStatic->SetWindowText(*m_psz);
  59. CCalendar * pCal = (CCalendar *) GetDlgItem(IDC_CALENDAR);
  60. pCal->SetDay(m_Day);
  61. pCal->SetMonth(m_Month);
  62. pCal->SetYear(m_Year);
  63. return TRUE; // return TRUE unless you set the focus to a control
  64. // EXCEPTION: OCX Property Pages should return FALSE
  65. }
  66. void CCalDlg::OnOK()
  67. {
  68. // TODO: Add extra validation here
  69. CCalendar * pCal = (CCalendar *) GetDlgItem(IDC_CALENDAR);
  70. m_Day = pCal->GetDay();
  71. m_Month = pCal->GetMonth();
  72. m_Year = pCal->GetYear();
  73. CDialog::OnOK();
  74. }
  75. void CCalDlg::OnDestroy()
  76. {
  77. CDialog::OnDestroy();
  78. // TODO: Add your message handler code here
  79. delete m_psz;
  80. }