Hi
I have implemented the XamGrid copy to clipboard operation using the XamGrid.CopyToClipboard method. The method works fine if I do not have notepad++ open. If its open and if I try a copy using Ctrl+C then it fails with the following error.
OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN)) ErrorCode:-2147221040
Kindly let me know what can be done. Also, please note that I cannot add any App.xaml code handlers because I cannot change that file.
Thanks
Chev
Hi Chev,
I've tested similar scenario and was not able to reproduce this issue. Could you please provide a sample project where it is easily reproducible?
Are you reproducing this consistently(for every invoke of XamGrid.CopyToClipboard() when the notepad++ is running)? Such an exception usually occurs during concurrent access to the clipboard. Is it happening when you try to copy text from a TextBox for example? Do you have any notepad++ plugins that are doing something with the clipboard ?
As a workaround you could wrap the XamGrid.CopyToClipboard() method in try catch and look for COMException - if such an exception is thrown the best solution is to add a short wait(I suppose few milliseconds would be enough) and try again(and probably make few more trials) - if it is still failing most probably some other application has opened the clipboard and kept it open for quite some time.
I am just checking if you got this worked out or you still require any assistance or clarification on the matter.
Regards,
Did you tried surrounding the call to CopyToClipboard in try catch block and if an COMException is thrown retry one more time after a while? If you provide the version of notepad++ and what if you have any plugins installed?
Hello Chev,
I am just checking your progress on this issue. Please do not hesitate to let me know if you have any further questions on this matter.
Hi,
I'm experiencing the same issue.
When Notepad++ is open I get this exception "OpenClipboard Failed CLIPBRD_E_CANT_OPEN" when I copy from XamGrid.
The version of Notepad++ is 6.4.1 (Build type : Jun 30 2013 - 01:32:53) that's the version installed in the company.
I've attach the plugin manager screen for all the plugin installed and the version.
Dominik
Hello Dominic,
Thank you for your post!
I was able to reproduce the issue and have logged this behavior with our developers in our tracking system, with an issue ID of 185945. I have also created a support ticket on your behalf with number CAS-147965-F3P3M0 in order to link the development issue to it so that you are automatically updated when a Service Release containing your fix is available for download.
Hi, Is this issue resolved now? Was this fixed in 16.2?