Output a new control that descends from "TMemo" to intercept the WM_PASTE message:
type TPastelessMemo = class(TMemo) protected procedure WMPaste(var Message: TWMPaste); message WM_PASTE; end; uses clipbrd; procedure TPastelessMemo.WMPaste(var Message: TWMPaste); var SaveClipboard: string; begin SaveClipboard := Clipboard.AsText; Clipboard.AsText := 'Simple Question'; inherited; Clipboard.AsText := SaveClipboard; end;
If you want to completely prohibit any insertion operation, clear the WMPaste handler.
Sertac akyuz
source share