Articles

Use DisplayClipboard procedure for monitoring the clipboard content of text or bitmap formats at runtime.

...
  private
    procedure DisplayClipboard(var Msg: TWMDrawClipBoard); 
      message WM_DRAWCLIPBOARD;
...
var
  Form1: TForm1;
  ClipboardWindow: HWND;

implementation

{$R *.DFM}

procedure TForm1.DisplayClipboard(var Msg: TWMDrawClipBoard);
var
  MyHandle: THandle;
begin
  if IsClipboardFormatAvailable(CF_TEXT) or
     IsClipboardFormatAvailable(CF_BITMAP) then
  begin
    OpenClipboard(Form1.Handle);
    if IsClipboardFormatAvailable(CF_TEXT)then
    begin
      MyHandle:=Clipboard.GetAsHandle(CF_TEXT);
      Memo1.Lines.Add(StrPas(GlobalLock(MyHandle)));
      GlobalUnlock(MyHandle);
    end;

    if IsClipboardFormatAvailable(CF_BITMAP) then
    begin
      Panel1.Visible:=True;
      Image1.Picture.Assign(Clipboard);
    end;
    CloseClipboard;
  end;
  SendMessage(ClipboardWindow, WM_DRAWCLIPBOARD, 0, 0);
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  OpenClipboard(Form1.Handle);
  EmptyClipboard;
  CloseClipboard;
  Panel1.Visible:=False;
  ClipboardWindow:=SetClipboardViewer(Form1.Handle);
end;