From: Larry Lindstrom on
Hi Folks:

Developing on WinXP, VS 2008 Pro, WIN32, no MFC.

My app allows users to enter minutes, for meetings.
The dialog they use to do this consists of a date time
picker, and edit box, and Ok, Delete, and Cancel buttons.

If they enter text in the edit box the minutes record,
a class instance, has it's modified flag set, and if they
then change the date without saving the text, they are
asked "Do you want to change minutes record date and loose
changes?".

If they select "Yes", the date is changed and the text
is set to minutes for the new date, or no text, if that
date has no minutes.

The problemis if they answer "No", the date time picker
delivers another DTN_DATETIMECHANGE to my app, and they
are asked the question a second time. A second "No" will
cause the application to behave properly.

I realize there following fragment doesn't describe
what happens when "Yes" is hit, but it does show the
code when "No" is hit. Do you see why my app receives
two DTN_DATETIMECHANGE if the user selects "No"?

I hope this is coherent, it's 3:40 in the morning here.

Thanks
Larry

case WM_NOTIFY:
switch(((NMHDR*)lparam)->idFrom)
{
case IDC_DATE_TIME_PICKER:

#ifdef _DEBUG
nm_date_time_change_ptr = (NMDATETIMECHANGE *)lparam;;
#endif

if(((NMHDR*)lparam)->code == DTN_DATETIMECHANGE)
{
if(local_minutes_record_ptr->get_modified())
{
// The user is about to loose a modified minutes
// record.
messagebox_text =
TEXT("Do you want to change minutes "
"record date and loose changes?");

messagebox_response =
MessageBox(hdlg, messagebox_text.c_str(),
TEXT("TFA"), MB_YESNO);

ignore_date_change = messagebox_response == IDNO;
}
}

if(!ignore_date_change)
{
Blah Blah Blah....
}

return 0;
}

break;