请求的剪贴板操作未成功 [英] Requested Clipboard operation did not succeed

查看:580
本文介绍了请求的剪贴板操作未成功的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Exception Type: ExternalException

Message: Requested Clipboard operation did not succeed.

Method: ThrowIfFailed

Source: System.Windows.Forms



Stack Trace:

   at System.Windows.Forms.Clipboard.ThrowIfFailed(Int32 hr)
   at System.Windows.Forms.Clipboard.SetDataObject(Object data, Boolean copy, Int32 retryTimes, Int32 retryDelay)
   at System.Windows.Forms.Clipboard.SetText(String text, TextDataFormat format)
   at System.Windows.Forms.Clipboard.SetText(String text)
   at Deerfield.Base.Controls.DataGridView.ProcessCmdKey(Message& msg, Keys keyData) in C:\Users\Developer\Desktop\deerfield\src\core\Deerfield\Deerfield.Base\Controls\DataGridView.cs:line 555
   at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
   at System.Windows.Forms.Control.ProcessCmdKey(Message& msg, Keys keyData)
   at System.Windows.Forms.TextBoxBase.ProcessCmdKey(Message& msg, Keys keyData)
   at System.Windows.Forms.Control.PreProcessMessage(Message& msg)
   at System.Windows.Forms.Control.PreProcessControlMessageInternal(Control target, Message& msg)
   at System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(MSG& msg)

我用谷歌搜索了一下,但是对于为什么会这样,我无法得到一个好的答案。

I googled this, but I cannot get a decent answer as to why this is happening.

MSDN文档指出,这种情况通常在用户切换到另一个应用程序时发生,但事实并非如此。

The MSDN documentation says that this often happens when the user switches to another application, but it does not appear that this was the case.

推荐答案

也有类似的问题。找到了这个条目 ,基本上就是说在通话中将 retryTimes 设置为2:

Having a similar problem. Found this entry, which basically says to set retryTimes to 2 in the call:

Clipboard.SetDataObject(object data, bool copy, int retryTimes, int retryDelay)

去尝试一下。如果有人可以发布可复制的测试用例,那就太好了。

Going to try it. Would be nice if anyone could post a reproducible test case.

这篇关于请求的剪贴板操作未成功的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆