私は問題を抱えており、それに関する Web 上の投稿を 2 つまたは 3 つ見つけただけです。リクエストは失敗します。
System.Runtime.InteropServices.ExternalException: Requested Clipboard operation did not succeed.
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)
Chrome を閉じて動作し、Chrome を再度開いても、数分後にまだ失敗します。次のコードを 1 秒のタイマーと GetOpenClipboardWindow()、別の PInvoke :( で使用して、これが本当に Chrome であることを確認しています。
[DllImport("user32.dll")]
static extern IntPtr GetOpenClipboardWindow();
[DllImport("user32.dll", SetLastError = true)]
static extern int GetWindowThreadProcessId(IntPtr hWnd, out int
lpdwProcessId);
IntPtr hwnd = GetOpenClipboardWindow();
if (hwnd != IntPtr.Zero)
{
int processId;
GetWindowThreadProcessId(hwnd, out processId);
Process p = Process.GetProcessById(processId);
listBox1.Items.Add(p.Modules[0].FileName);
}
すでにこの問題を抱えている人はいますか?Chrome がクリップボードを盗んでいる理由を知っていますか?
[編集]
Chrome チーム メンバーのいずれかで: 親愛なる開発者、今日これを読んだ場合は、私のクリップボードに対してあなたよりも多くの権利を持っているので、私のクリップボードを返してください。あなたのせいで2日間探してた。