首先,你需要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
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
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货