Lt wrote:
> I works now. I've changed the line:
> nCount = Calendar.GetMonthRange(&timeFrom, &timeUntil, GMR_DAYSTATE);
> to:
> nCount =
> ((CMonthCalCtrl*)GetDlgItem(IDC_MONTHCALENDAR2))->GetMonthRange(&timeFrom,
> &timeUntil, GMR_DAYSTATE);
That line only works by accident. GetDlgItem returns a HWND, which happens
to be the first member inside CMonthCalCtrl. Then GetMonthRange only uses
that first member.
Typecasts are not magic that turns anything into anything else. Avoid as
many typecasts as possible. When the compiler tells you that your code is
not well-formed, fix the code. Typecasts only throw away compiler
diagnostics.
Try:
CMonthCalCtrl cal(GetDlgItem(IDC_MONTHCALENDAR2));
int nCount = cal.GetMonthRange(...);
Note that not cramming things all on one line makes them easier to fix, and
note that nCount should not exist before it is assigned.
--
Phlip
http://industrialxp.org/community/bi...UserInterfaces