unit ClipboardViewer;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms,
Dialogs;
type
TForm1 = class (TForm)
procedure FormCreate(Sender: TObject);
procedure FormDestroy(Sender: TObject);
private
FNextViewerHandle : THandle;
procedure WMDrawClipboard ( var message : TMessage);
message WM_DRAWCLIPBOARD;
procedure WMChangeCBCHain ( var message : TMessage);
message WM_CHANGECBCHAIN;
public
end ;
var
Form1: TForm1;
implementation
procedure TForm1.FormCreate(Sender: TObject);
begin
FNextViewerHandle := SetClipboardViewer(Handle);
end ;
procedure TForm1.FormDestroy(Sender: TObject);
begin
ChangeClipboardChain(Handle, FNextViewerHandle);
end ;
procedure TForm1.WMDrawClipboard ( var message : TMessage);
begin
message .Result := SendMessage(WM_DRAWCLIPBOARD, FNextViewerHandle, 0 , 0 );
end ;
procedure TForm1.WMChangeCBCHain ( var message : TMessage);
begin
if message .wParam = FNextViewerHandle then begin
FNextViewerHandle := message .lParam;
message .Result := 0 ;
end else begin
message .Result := SendMessage(FNextViewerHandle, WM_CHANGECBCHAIN,
message .wParam, message .lParam);
end ;
end ;
end . |