Pelles C forum

C language => Windows questions => Topic started by: tpekar on July 08, 2014, 04:12:19 PM

Title: DATETIMEPICK_CLASS pre-load
Post by: tpekar on July 08, 2014, 04:12:19 PM
I am trying to load a DATETIMEPICK_CLASS control with my own default date but it keeps replacing it with today's date.  Is there a way to keep it from doing that?  Thanks in advance.
Title: Re: DATETIMEPICK_CLASS pre-load
Post by: jj2007 on July 08, 2014, 07:48:32 PM
In line 44, right under "WM_CREATE", put the DTM_SETSYSTEMTIME message.
Title: Re: DATETIMEPICK_CLASS pre-load
Post by: JohnF on July 08, 2014, 08:35:47 PM
This seems to work but it was not clear which macro to use at first.

Code: [Select]
SYSTEMTIME st;
GetSystemTime(&st);
st.wYear = 2000; // set any
st.wMonth = 2;
st.wDay   = 3;

MonthCal_SetCurSel(hwndCal, &st);


John
Title: Re: DATETIMEPICK_CLASS pre-load
Post by: JohnF on July 09, 2014, 06:02:34 PM
tpekar,

You can also turn off the today stuff at the bottom. Use the style MCS_NOTODAY when creating the control.

John
Title: Re: DATETIMEPICK_CLASS pre-load
Post by: tpekar on July 11, 2014, 04:18:48 PM
Thanks JohnF.  That worked.