[DllImport("user32.dll", SetLastError=true)]
static extern bool CloseClipboard();
None.
None.
I read on google about a flaw in the .Net System.Windows.Forms.Clipboard.SetDataObject
where you had to run the SetDataObject function twice for it to work. On the first
try it would just error out and the second with work just fine. Well I found that
by using the 3 clipboard API's below first it work every time and you don't have to
wait for the error.
OpenClipboard(IntPtr.Zero);
EmptyClipboard();
CloseClipboard();
try
{
System.Windows.Forms.Clipboard.SetDataObject("your message here \n if you would like", true);
}
catch
{
try
{
System.Windows.Forms.Clipboard.SetDataObject("your message here \n if you would like", true);
}
catch { };
}
System.Windows.Forms.Clipboard.SetDataObject("your message here \n if you would like", true);