CXTDateTimeCtrl m_monthCal;
int CMainFrame::OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl)
{
m_monthCal.Create(WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_BORDER | DTS_SHORTDATEFORMAT , CRect(0, 0, 150, 22), (CWnd*)this, IDC_CALENDAR))
ON_NOTIFY(DTN_DATETIMECHANGE, ID_REAL_TIME_CTL, OnTimeOK)
void CMainFrame::OnTimeOK(NMHDR *pNMHDR, LRESULT *pResult)
{
}
不知道为什么不能响应?我用的是CXTDateTimeCtrl,帮帮忙
创建代码是这样的!
int CMainFrame::OnCreateControl(LPCREATECONTROLSTRUCT lpCreateControl)
{
if (lpCreateControl->nID == ID_REAL_TIME_CTL)
{
const IDC_CALENDAR = 400;
if(!m_monthCal.m_hWnd)
{
if (!m_monthCal.Create(WS_TABSTOP | WS_CHILD | WS_VISIBLE | WS_BORDER | DTS_SHORTDATEFORMAT , CRect(0, 0, 150, 22), (CWnd*)this, IDC_CALENDAR))
{
return FALSE;
}
CXTPControlCustom* pControlMonthCal = (CXTPControlCustom*)CXTPControlCustom::CreateObject();
pControlMonthCal->SetFlags(xtpFlagManualUpdate);
pControlMonthCal->SetControl(&m_monthCal);
CString formatStr= _T("yyyy-MM-dd HH:mm");
m_monthCal.SetFormat(formatStr.GetBuffer());
lpCreateControl->pControl = pControlMonthCal;
}
return TRUE;
}
}
回复于 2006-09-22 11:44:44 得分 0
已经搞平,谢谢大家,是我消息映射的ID写成ToolBar ID了,应该是m_monthCal的