Perfeccionando el visor del ClipBoard:
Código Delphi
[-]
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, Clipbrd;
type
TForm1 = class(TForm)
Memo1: TMemo;
procedure FormCreate(Sender: TObject);
private
NextViewer: HWND;
procedure GetData;
protected
procedure WndProc(var Message: TMessage); override;
public
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.FormCreate(Sender: TObject);
begin
NextViewer:= SetClipboardViewer(Handle);
end;
procedure TForm1.WndProc(var Message: TMessage);
begin
case Message.Msg of
WM_DRAWCLIPBOARD:
begin
if NextViewer <> 0 then
SendMessage(NextViewer, WM_DRAWCLIPBOARD, 0, 0);
GetData();
end;
WM_DESTROY:
ChangeClipboardChain(Handle, NextViewer);
WM_CHANGECBCHAIN:
if HWND(Message.WParam) = NextViewer then
NextViewer:= Message.LParam
else if NextViewer <> 0 then
SendMessage(NextViewer, WM_CHANGECBCHAIN, Message.WParam, Message.LParam);
end;
inherited WndProc(Message);
end;
procedure TForm1.GetData;
begin
if Clipboard.HasFormat(CF_TEXT) then
Memo1.Lines.Add(Clipboard.AsText);
end;
end.
Saludos.