How about this?

procedure TMainForm.FormCreate(Sender: TObject);
begin
  Application.OnIdle := OnIdle;
end;

procedure TMainForm.OnIdle(Sender: TObject; var Done: Boolean);
begin
  if Pos('yyyy', ShortDateFormat) = 0 then
    ShortDateFormat := StringReplace(ShortDateFormat, 'yy', 'yyyy',
[rfReplaceAll]);
end;

Also, if you have any forms with the TDateTimePicker component, add the
following to the FormCreate procedure:

  SendMessage(DateTimePicker1.Handle, DTM_SETFORMAT, 0,
LPARAM(PChar(ShortDateFormat)));

You will need to add CommCtrl to the 'uses' list.

==================================================================

Tom Munro Glass

+----------------------------------------------------------------+
| E-mail:                                                        |
|     Internet:           [EMAIL PROTECTED]                         |
|     CompuServe:         100101,1243 or [EMAIL PROTECTED]   |
| Web sites:                                                     |
|     TMG CONSULTANCY:    http://www.tmgcon.com                  |
|     Tewkesbury Web:     http://www.tmgcon.com/tewksweb         |
+----------------------------------------------------------------+

---------------------------------------------------------------------------
    New Zealand Delphi Users group - Delphi List - [EMAIL PROTECTED]
                  Website: http://www.delphi.org.nz

Reply via email to