这是一个简单的演示程序,可以使TDateTimePicker不显示任何东西哦[
]。
type
TForm1 = class(TForm)
...
private
FNewWndProc, FOldWndProc: TFarProc;
procedure MyWndProc(var Msg: TMessage);
...
end;
procedure TForm1.MyWndProc(var Msg: TMessage);
begin
if Msg.Msg = WM_PAINT then
else
Msg.Result := CallWindowProc(FOldWndProc,
DateTimePicker1.Handle, Msg.Msg,
Msg.wParam, Msg.lParam);
end;
procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
RestoreWndProc;
end;
procedure TForm1.RestoreWndProc;
begin
SetWindowLong(DateTimePicker1.Handle, GWL_WNDPROC,
LongInt(FOldWndProc));
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
FOldWndProc := Pointer(GetWindowLong(
DateTimePicker1.Handle, GWL_WNDPROC));
FNewWndProc := MakeObjectInstance(MyWndProc);
SetWindowLong(DateTimePicker1.Handle, GWL_WNDPROC,
LongInt(FNewWndProc));
end;