// mymfc24View.cpp : implementation of the CMymfc24View class
//

#include "stdafx.h"
#include "mymfc24.h"

#include "mymfc24Doc.h"
#include "mymfc24View.h"
#include "ActiveXDialog.h"

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

/////////////////////////////////////////////////////////////////////////////
// CMymfc24View

IMPLEMENT_DYNCREATE(CMymfc24View, CView)

BEGIN_MESSAGE_MAP(CMymfc24View, CView)
	//{{AFX_MSG_MAP(CMymfc24View)
	ON_WM_LBUTTONDOWN()
	//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CMymfc24View construction/destruction

CMymfc24View::CMymfc24View()
{
	// TODO: add construction code here

}

CMymfc24View::~CMymfc24View()
{
}

BOOL CMymfc24View::PreCreateWindow(CREATESTRUCT& cs)
{
	// TODO: Modify the Window class or styles here by modifying
	//  the CREATESTRUCT cs

	return CView::PreCreateWindow(cs);
}

/////////////////////////////////////////////////////////////////////////////
// CMymfc24View drawing

void CMymfc24View::OnDraw(CDC* pDC)
{
	// TODO: add draw code for native data here
	pDC->TextOut(0, 0, "Press the left mouse button here.");
}

/////////////////////////////////////////////////////////////////////////////
// CMymfc24View diagnostics

#ifdef _DEBUG
void CMymfc24View::AssertValid() const
{
	CView::AssertValid();
}

void CMymfc24View::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}

CMymfc24Doc* CMymfc24View::GetDocument() // non-debug version is inline
{
	ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMymfc24Doc)));
	return (CMymfc24Doc*)m_pDocument;
}
#endif //_DEBUG

/////////////////////////////////////////////////////////////////////////////
// CMymfc24View message handlers

void CMymfc24View::OnLButtonDown(UINT nFlags, CPoint point) 
{
	// TODO: Add your message handler code here and/or call default
	CActiveXDialog dlg;
    dlg.m_BackColor = RGB(255, 251, 240); // light yellow
    COleDateTime today = COleDateTime::GetCurrentTime();
    dlg.m_varValue = COleDateTime(today.GetYear(), today.GetMonth(),
                                  today.GetDay(), 0, 0, 0);
    if (dlg.DoModal() == IDOK) {
        COleDateTime date(dlg.m_varValue);
        AfxMessageBox(date.Format("%B %d, %Y"));
    }
}

