【发布时间】:2015-10-09 11:32:38
【问题描述】:
我正在开发一个应用程序,单击按钮将清除系统剪贴板和办公室剪贴板。
我已经尝试过System.Windows.Forms.Clipboard.Clear() 和以下
static class WinAPI
{
[System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]
static extern bool OpenClipboard(System.IntPtr WinHandle);
[System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]
static extern bool EmptyClipboard();
[System.Runtime.InteropServices.DllImport("user32.dll", SetLastError = true)]
static extern bool CloseClipboard();
public static void ClearClipboard()
{
if (OpenClipboard(System.IntPtr.Zero))
{
EmptyClipboard();
CloseClipboard();
}
}
}
它们似乎都只有系统剪贴板清晰。有没有办法将此扩展到办公室剪贴板。
【问题讨论】:
标签: c# office-interop