Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to Get the Date Value from CMonthCalCtrl and CDateTimeCtrl ?

How to Get the Date Value from CMonthCalCtrl and CDateTimeCtrl ?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialhelpquestioncareer
2 Posts 2 Posters 1 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Ariel
    wrote on last edited by
    #1

    Hi there All, I'm trying to Retrive the Date in form of COleDateTime from a CMonthCalCtrl and CDateTimeCtrl but not very succesfull at this. I'm trying to Use the BOOL GetCurSel( COleDateTime& refDateTime ) const; function but then i get an invalid Date - i tried to catch different Messages of the Above Controls and none of them do the Job. Can somone please Help me, Just a short Code example to see how its done will be more than enough. Thanks in advance, Ariel.

    L 1 Reply Last reply
    0
    • A Ariel

      Hi there All, I'm trying to Retrive the Date in form of COleDateTime from a CMonthCalCtrl and CDateTimeCtrl but not very succesfull at this. I'm trying to Use the BOOL GetCurSel( COleDateTime& refDateTime ) const; function but then i get an invalid Date - i tried to catch different Messages of the Above Controls and none of them do the Job. Can somone please Help me, Just a short Code example to see how its done will be more than enough. Thanks in advance, Ariel.

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      GetCurSel uses MCM_GETCURSEL which doesn't fill in the time members in the SYSTEMTIME stucture. SYSTEMTIME tSysTime; m_uiCalendar.GetCurSel(&tSysTime); tSysTime.wHour = 0; tSysTime.wMinute = 0; tSysTime.wSecond = 0; tSysTime.wMilliseconds = 0; COleDateTime dtDate(tSysTime); Step through the code or search for _AfxOleDateFromTm in the source to see where the COleDateTime is set to invalid.

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups