See Subclassing Controls on MSDN, and Safer subclassing on Raymond Chen's blog. For example:
uses
Winapi.CommCtrl;
function CalendarSubclassProc(hWnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM;
uIdSubclass: UINT_PTR; dwRefData: DWORD_PTR): LRESULT; stdcall;
begin
case uMsg of
WM_LBUTTONDOWN: begin
TDateTimePicker(dwRefData).Format := '';
end;
WM_NCDESTROY: begin
RemoveWindowSubclass(hWnd, @CalendarSubclassProc, uIdSubclass);
end;
end;
Result := DefSubclassProc(hWnd, uMsg, wParam, lParam);
end;
procedure TForm1.DateTimePicker1DropDown(Sender: TObject);
var
cal: HWND;
begin
cal := DateTime_GetMonthCal(DateTimePicker1.Handle);
SetWindowSubclass(cal, @CalendarSubclassProc, 1, DWORD_PTR(DateTimePicker1));
end;