首先,你需要SetClipboardViewer函数将你的窗体设定为剪贴板察看器。
hwndNextClip:=SetClipboardViewer(MainForm.Handle);当设定成功后。系统在有剪贴时会给注册的窗体发送WM_DRAWCLIPBOARD消息。
你可以建立一个窗体消息处理局柄处理:type
  TMainForm = class(TForm)
  procedure WMDrawClip(var Message:TMessage);message WM_DRAWCLIPBOARD;
...
end;procedure TMainForm.WMDrawClip(var Message:TMessage);
var
//  hwndClipOwner:Integer;
  strTemp:String;
  uFormat,i,iFormat:Integer;
//  oleTemp:TOleContainer;
//  strFormatType:String;
  buffer:PChar;
begin
   //bCanpaste set to false indicate that the data in the
   //clipboard is copied from application. So set it to true
   SendMessage(hwndNextClip,Message.Msg,Message.WParam ,Message.LParam );
   ...
end;范例:
http://www.applevb.com/sourcecode/ClipV.zip

解决方案 »

  1.   

    当应用程序把自己添加到剪贴板观测链后,每当发生剪贴板中的数据发生变化,Windows都会发送一个消息到剪贴板观测链中的程序。当一个应用程序处理完剪贴板中的数据后,再把此消息传递给剪贴板中的下一个程序,以免观察链断掉。在程序退出前,应当把自己从观察链中删除,否则将影响观察链的运作。
      

  2.   

    那Delphi的消息机制是怎么一回事?