This is a migrated thread and some comments may be shown as answers.

OpenClipboard Failed Exception on Shift-Del

2 Answers 206 Views
MaskedInput (Numeric, DateTime, Text, Currency)
This is a migrated thread and some comments may be shown as answers.
Top achievements
Rank 1
Chad asked on 22 Sep 2016, 07:28 AM

RadMaskedTextInput fails on cut using shift-del.

Just tried your R3 2016 demo and it also throws what seems to be the same exception.

System.Runtime.InteropServices.COMException (0x800401D0): OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN))


01.System.Runtime.InteropServices.COMException (0x800401D0): OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN))
02.   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
03.   at System.Windows.Clipboard.Flush()
04.   at System.Windows.Clipboard.CriticalSetDataObject(Object data, Boolean copy)
05.   at System.Windows.Clipboard.SetDataInternal(String format, Object data)
06.   at System.Windows.Clipboard.SetText(String text, TextDataFormat format)
07.   at System.Windows.Clipboard.SetText(String text)
08.   at Telerik.Windows.Controls.RadMaskedInputBase.HandleCopySelected(TextMode mode)
09.   at Telerik.Windows.Controls.RadMaskedInputBase.HandleCutSelected()
10.   at Telerik.Windows.Controls.RadMaskedInputBase.HandleCut()
11.   at Telerik.Windows.Controls.RadMaskedInputBase.OnApplicationCut(Object sender, ExecutedRoutedEventArgs e)
12.   at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
13.   at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
14.   at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
15.   at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
16.   at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
17.   at System.Windows.UIElement.OnExecutedThunk(Object sender, ExecutedRoutedEventArgs e)
18.   at System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
19.   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
20.   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
21.   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
22.   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
23.   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
24.   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
25.   at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
26.   at System.Windows.Input.RoutedCommand.ExecuteCore(Object parameter, IInputElement target, Boolean userInitiated)
27.   at System.Windows.Input.CommandManager.TranslateInput(IInputElement targetElement, InputEventArgs inputEventArgs)
28.   at System.Windows.UIElement.OnKeyDownThunk(Object sender, KeyEventArgs e)
29.   at System.Windows.Input.KeyEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
30.   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
31.   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
32.   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
33.   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
34.   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
35.   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
36.   at System.Windows.Input.InputManager.ProcessStagingArea()
37.   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
38.   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
39.   at System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
40.   at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
41.   at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
42.   at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
43.   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
44.   at System.Windows.Threading.ExceptionWrapper.TryCatchWhen(Object source, Delegate callback, Object args, Int32 numArgs, Delegate catchHandler)
45.   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
46.   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
47.   at System.Windows.Interop.HwndSource.OnPreprocessMessageThunk(MSG& msg, Boolean& handled)
48.   at System.Windows.Interop.HwndSource.WeakEventPreprocessMessage.OnPreprocessMessage(MSG& msg, Boolean& handled)
49.   at System.Windows.Interop.ComponentDispatcherThread.RaiseThreadMessage(MSG& msg)
50.   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
51.   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
52.   at System.Windows.Application.RunDispatcher(Object ignore)
53.   at System.Windows.Application.RunInternal(Window window)
54.   at System.Windows.Application.Run(Window window)
55.   at System.Windows.Application.Run()



2 Answers, 1 is accepted

Sort by
Martin Ivanov
Telerik team
answered on 26 Sep 2016, 09:31 AM
Hi Chad,

I wasn't able to reproduce the exception, neither in the demos application or in a new project. However, it seems that the clipboard allows only a single process to work with it. So, if for some reason another process uses the clipboard while you try to cut the text, the exception will occur. You can restart your machine and then try to cut the text, and see if the issue still occurs. If this is your case you can catch the exception and show a message that says the clipboard is in use.

Telerik by Progress
Do you need help with upgrading your AJAX, WPF or WinForms project? Check the Telerik API Analyzer and share your thoughts.
Top achievements
Rank 1
answered on 28 Sep 2016, 09:46 PM

Thanks Martin,

Seems 1 of my 100s of tools might have been the cause. I do however think that it might be one of those cases where it would be best to just handle the exception internally rather than propagating it to the consumer. It is after all an external issue that's causing it. Last thing we need is a bug in some other application causing breaks on our software.


MaskedInput (Numeric, DateTime, Text, Currency)
Asked by
Top achievements
Rank 1
Answers by
Martin Ivanov
Telerik team
Top achievements
Rank 1
Share this question