Call back for calendar? WINAPI
Jul 10, 2014 at 6:38pm UTC
I have made a calendar using a resource file and using the winapi
1 2 3 4 5 6 7
CALENDAR_DLG DIALOG 0, 0, 186, 95
STYLE DS_3DLOOK | DS_CENTER | DS_MODALFRAME | DS_SHELLFONT | WS_CAPTION | WS_VISIBLE | WS_POPUP | WS_SYSMENU
CAPTION "Calendar"
FONT 8, "Ms Shell Dlg"
{
CONTROL "" , CALENDAR, "SysMonthCal32" , WS_VISIBLE, 0, 0, 186, 95
}
My call back function is
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
BOOL CALLBACK DlgCalendar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_INITDIALOG:
{
}
return TRUE;
case WM_CLOSE:
{
EndDialog(hwndDlg, 0);
}
return TRUE;
case DTN_DATETIMECHANGE:
{
exit(5);
}
}
return FALSE;
}
DTN_DATETIMECHANGE is not being called ? What is UMSG equal to when a date is changed in the calendar?
Many thanks
Jul 11, 2014 at 9:45am UTC
Jul 13, 2014 at 12:25am UTC
You got the WM_NOTIFY bit right but wParam is not equal to DTN_DATETIMECHANGE when I choose another date. the entire variable the lower bits or the higher bits none are equal to this value.
I did how ever find some research about the lParam so I wrote some code but it did not work either..
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
BOOL CALLBACK DlgCalendar(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch (uMsg)
{
case WM_NOTIFY:
{
switch (((LPNMHDR)lParam)->code)
{
case DTN_DATETIMECHANGE:
{
HWND _calendar;
SYSTEMTIME calTime;
stringstream ss;
_calendar = GetDlgItem(hwndDlg, CALENDAR);
MonthCal_GetCurSel(_calendar, (LPSYSTEMTIME)&calTime);
ss << "Confirm date: " << calTime.wDay << "/" << calTime.wMonth << "/" << calTime.wYear;
int a = MessageBoxA(0, ss.str().c_str(), "" , MB_YESNO);
if (a == IDYES)
{
calendarSelDate = calTime;
calendarSelection = true ;
EndDialog(hwndDlg, 0);
}
}
}
}
case WM_INITDIALOG:
{
}
return TRUE;
case WM_CLOSE:
{
EndDialog(hwndDlg, 0);
}
return TRUE;
case DTN_DATETIMECHANGE:
{
exit(5);
}
}
return FALSE;
}
Anyone know what I am doing wrong?
Jul 13, 2014 at 1:41am UTC
bump-
Jul 17, 2014 at 9:42pm UTC
bump --
Jul 18, 2014 at 8:49am UTC
Topic archived. No new replies allowed.