Click to See Complete Forum and Search --> : DateTime Picker and MTS_NOTODAY


DiscoInferno
April 14th, 1999, 09:40 AM
I am attempting to modify the behaviour od the date time picker control so that when the user hits the drop down arrow of the calendar , the calendar is displayed without the Today date and the today circle. I have overode the DTN_DROPDOWN handler with the code shown below and I am attempting to change the style so that it excludes MTS_NOTODAY using GetWindowLong() and SetWindowLong() and the GWL_STYLE identifier. Is this the right identifier to use for common controls ? as the code seems to be having no effect.

ccode
LRESULT CImsPMQCtrl::OnDropdownDatetime_end(int idCtrl, LPNMHDR pnmh,
BOOL& bHandled)
{
HWND MCCtrlHWND;
MCCtrlHWND = (HWND)::SendMessage(m_hWNDEndDate, DTM_GETMONTHCAL, 0, 0);
long lStyle = ::GetWindowLong (MCCtrlHWND, GWL_STYLE);

lStyle &= ~MCS_NOTODAY;
lStyle &= ~MCS_NOTODAYCIRCLE;
::SetWindowLong (MCCtrlHWND, GWL_STYLE, lStyle);
return 0;
}
/ccode

James Lacey
April 22nd, 1999, 02:54 PM
Here is how you would do it with MFC.

void CDayTimeDlg::OnDropdownDatetimepicker(NMHDR* pNMHDR, LRESULT* pResult)
{
CDateTimeCtrl * pDateTimeCtrl = (CDateTimeCtrl*)FromHandle(pNMHDR->hwndFrom);
CMonthCalCtrl * pMonthCal = pDateTimeCtrl->GetMonthCalCtrl();
pMonthCal->ModifyStyle(0, MCS_NOTODAY | MCS_NOTODAYCIRCLE);

*pResult = 0;
}

DiscoInferno
April 24th, 1999, 04:11 AM
Thanks very much, It is now working correctly