开发者

Detect when cut-ed data is being pasted in MFC COleDataSource VS2008

I need to detect when another application /window in my app does paste on my previously set data , so I can remove it from my source window. I have discovered that COleDataSource::DelaySetData theoretically does this and COleDataSource::OnSetData would get called when paste occur开发者_高级运维s, but I can not be sure. MSDN is (as usually) vague about this matter and does not clearly say one way or the other.I will be using an custom format and watever format is explorer using for cut/paste files. So the question is how EXACTLY (not theoretically) can this be done. I really need to remove the items from my window if and only if they are pasted somewhere else.


You're doing it all wrong. When you Cut something it's supposed to be deleted immediately, and you should provide an undo function if it needs to be restored.

The clipboard was not designed for bidirectional signalling. DelaySetData is intended for applications which are submitting large amounts of data in different formats, so that they only need to provide the format which is required by the receiver; using it to detect when a paste occurs is relying on a side effect. There are clipboard managers which might make this fail.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜