I have an application where i am using Clipboard for copy, paste operations. For copying i have used this code
Clipboard.Clear();
const byte VK_CONTROL = 0x11;
keybd_event(VK_CONTROL, 0, 0, 0);
keybd_event(0x43, 0, 0, 0); //Send the C key (43 is "C")
keybd_event(0x43, 0, CONST_KEYEVENTF_KEYUP, 0);
keybd_event(VK_CONTROL, 0, CONST_KEYEVENTF_KEYUP, 0);
But it's giving an error saying Unable to Perform the Clipboard Action and I am unable to paste it.It's throwing an exception.
Can anybody please help me to fix this issue or Please suggest some other ways to clear the Clipboard content before we copy.