CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Apr 1999
    Posts
    3

    DateTime Picker and MTS_NOTODAY

    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


  2. #2
    Join Date
    Apr 1999
    Posts
    3

    Re: DateTime Picker and MTS_NOTODAY

    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;
    }




  3. #3
    Join Date
    Apr 1999
    Posts
    3

    Re: DateTime Picker and MTS_NOTODAY

    Thanks very much, It is now working correctly


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured