Beruflich Dokumente
Kultur Dokumente
// ActiveXDialog.h
//{{AFX_INCLUDES()
#include "calendar.h"
//}}AFX_INCLUDES
#if !
defined(AFX_ACTIVEXDIALOG_H__3B54E62F_C5CB_46C3_9E17_97E24
087B3A5__INCLUDED_)
#define
AFX_ACTIVEXDIALOG_H__3B54E62F_C5CB_46C3_9E17_97E24087B3A5
__INCLUDED_
// ActiveXDialog dialog
protected:
virtual void DoDataExchange(CDataExchange* pDX);
//}}AFX_VIRTUAL
protected:
virtual BOOL OnInitDialog();
afx_msg void OnDate();
afx_msg void OnNextweek();
virtual void OnOK();
//}}AFX_MSG
DECLARE_MESSAGE_MAP()
};
#endif // !
defined(AFX_ACTIVEXDIALOG_H__3B54E62F_C5CB_46C3_9E17_97E24
087B3A5__INCLUDED_)
// ActiveXDialog.cpp
#include "stdafx.h"
#include "ActiveXCtrlCalendar.h"
#include "ActiveXDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// ActiveXDialog dialog
BOOL ActiveXDialog::OnInitDialog()
{
CDialog::OnInitDialog();
m_calendar.SetValue(m_varvalue);
return TRUE;
}
void ActiveXDialog::OnDate()
{
CDataExchange dx(this,TRUE);
DDX_Text(&dx,IDC_DAY,m_day);
DDX_Text(&dx,IDC_MONTH,m_month);
DDX_Text(&dx,IDC_YEAR,m_year);
m_calendar.SetDay(m_day);
m_calendar.SetMonth(m_month);
m_calendar.SetYear(m_year);
}
void ActiveXDialog::OnNextweek()
{
m_calendar.NextWeek();
}
void ActiveXDialog::OnOK()
{
m_varvalue=m_calendar.GetValue();
CDialog::OnOK();
}
// ActiveXCtrlCalendarView.cpp
#include "stdafx.h"
#include "ActiveXCtrlCalendar.h"
#include "ActiveXCtrlCalendarDoc.h"
#include "ActiveXCtrlCalendarView.h"
#include "ActiveXDialog.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// CActiveXCtrlCalendarView
IMPLEMENT_DYNCREATE(CActiveXCtrlCalendarView, CView)
BEGIN_MESSAGE_MAP(CActiveXCtrlCalendarView, CView)
//{{AFX_MSG_MAP(CActiveXCtrlCalendarView)
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW,
CView::OnFilePrintPreview)
END_MESSAGE_MAP()
// CActiveXCtrlCalendarView construction/destruction
CActiveXCtrlCalendarView::CActiveXCtrlCalendarView()
{}
CActiveXCtrlCalendarView::~CActiveXCtrlCalendarView()
{}
BOOL CActiveXCtrlCalendarView::PreCreateWindow(CREATESTRUCT&
cs)
{
return CView::PreCreateWindow(cs);
}
// CActiveXCtrlCalendarView drawing
void CActiveXCtrlCalendarView::OnDraw(CDC* pDC)
{
CActiveXCtrlCalendarDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
}
// CActiveXCtrlCalendarView printing
CActiveXCtrlCalendarDoc* CActiveXCtrlCalendarView::GetDocument()
{
ASSERT(m_pDocument-
>IsKindOf(RUNTIME_CLASS(CActiveXCtrlCalendarDoc)));
return (CActiveXCtrlCalendarDoc*)m_pDocument;
}
#endif //_DEBUG
dlg.m_varvalue=COleDateTime(today.GetYear(),today.GetMonth(),toda
y.GetDay(),0,0,0);
if(dlg.DoModal()==IDOK)
{
COleDateTime date(dlg.m_varvalue);
AfxMessageBox(date.Format("%B %d, %Y"));
}
CView::OnLButtonDown(nFlags, point);
}
OUTPUT
NEXT WEEK