Главная страница | назад





Article #17570: TDateTimePicker exception.

 Question and Answer Database
FAQ2570C.txt TDateTimePicker exception.
Category :VCL
Platform :All
Product :C++Builder 3.x
Question:
The TDateTimePicker throws an exception when a date is not picked,
is there a workaround for this?
Answer:
Yes!
Try this:
'dtp' is your TDateTimePicker.
//------------------------------------------------------------------
__fastcall TForm1::TForm1(TComponent* Owner)
: TForm(Owner)
{
NMDATETIMECHANGE dtc;
SYSTEMTIME now;
GetSystemTime(&now);
dtc.nmhdr.hwndFrom = dtp->Handle;
dtc.nmhdr.idFrom = NULL;
dtc.nmhdr.code = DTN_DATETIMECHANGE;
dtc.dwFlags = GDT_VALID;
dtc.st = now;
dtp->Perform(WM_NOTIFY, NULL, (int)&dtc);
}
//------------------------------------------------------------------
7/2/98 10:32:32 AM

Last Modified: 01-SEP-99