Ошибка при вызове openclipboard windows 10

87 / 66 / 8

Регистрация: 29.09.2009

Сообщений: 425

1

Ошибка при чтении данных из буфера обмена

01.12.2010, 16:10. Показов 24662. Ответов 9


Доброго вермени суток.На ПК стоит WIN XP SP2. С недавних пор стал замечать что тупит буфер обмена.Т.е. после копирования(файла, текста) недоступен пункт меню «вставить». Ctrl+V тоже не срабатывает(просто ничего не происходит). В Paint попытка «вставить» приводит к ошибке: «Ошибка при чтении даных из буфера обмена». А в DownloadMaster попытка добавить новую закачку приводит к ошибке «Cannot open clipboard». Проблема возникает спонтанно и пока решается перезагрузкой. Кто что может посоветовать уважаемые форумчане? На вирусы проверял касперским, вроде ниче не нашел…

__________________
Помощь в написании контрольных, курсовых и дипломных работ, диссертаций здесь

0

Почетный модератор

14003 / 3621 / 87

Регистрация: 11.06.2009

Сообщений: 11,783

01.12.2010, 19:27

2

попробуйте пообщаться с программкой clipbrd.exe из папки Windows/system32…
там можно и смотреть и чистить буфер …
Для того чтобы очистить буфер обмена необходимо запустить уже известный нам файл и нажать на крестик либо «Правка – Удалить».
Да..еще может память протестировать попробовать..

2

87 / 66 / 8

Регистрация: 29.09.2009

Сообщений: 425

01.12.2010, 21:25

 [ТС]

3

Спасибо, прикольная штука «clipbrd.exe» сколько лет на винде сижу не знал даже. А память проверю, завтра отпишусь.

0

Почетный модератор

14003 / 3621 / 87

Регистрация: 11.06.2009

Сообщений: 11,783

01.12.2010, 21:40

4

Джуниор, признаюсь по секрету, только -чур никому, лады ? Если бы не Ваш вопрос, я бы тоже не узнал про этот встроенный утиль винды Ну ни к чему было

0

magirus

01.12.2010, 21:41

Не по теме:

Цитата
Сообщение от Almiqui
Посмотреть сообщение

я бы тоже не узнал про этот встроенный утиль винды

я про него уже забыть успел… :)

0

87 / 66 / 8

Регистрация: 29.09.2009

Сообщений: 425

08.12.2010, 15:20

 [ТС]

6

Лучший ответ Сообщение было отмечено vavun как решение

Решение

Сегодня наконец то повторилась проблема, которая описывается выше. Как и посоветовал Almiqui
запустил системную утилиту clipbrd.exe. Открывался долго долго и накнец руганулся что размер объекта буфера слишком велик(не знаю кто и что туда пытается копировать или это какой то сбой). Вобщем нажал очистить буфер. И все заработало без перезагрузки. Есть смутные подозрения что эту ситуацию с буфером вызывает VIRTUAL PC от Microsoft.

1

32 / 32 / 2

Регистрация: 06.07.2010

Сообщений: 129

03.01.2012, 23:53

7

У меня тоже эта проблема наблюдается. Однако нет никакого VIRTUAL PC. Значит не в нем дело.

0

680 / 330 / 5

Регистрация: 01.03.2010

Сообщений: 1,387

04.01.2012, 10:12

8

1. увеличить файл подкачки
2. сделать дефрагментацию HDD
3. прогнать память memtest’ом
4. почистить системный диск от мусора
5. временно удалить касперского
6. проверить систему на вирусяки утилиткой AVZ

0

278 / 197 / 62

Регистрация: 08.11.2010

Сообщений: 1,762

02.11.2015, 07:59

9

Была у меня такая проблема недавно, во всем был виноват Скайп.

0

1 / 1 / 0

Регистрация: 14.10.2012

Сообщений: 6

26.02.2016, 18:12

10

Цитата
Сообщение от Джуниор
Посмотреть сообщение

Сегодня наконец то повторилась проблема, которая описывается выше. Как и посоветовал Almiqui
запустил системную утилиту clipbrd.exe. Открывался долго долго и накнец руганулся что размер объекта буфера слишком велик(не знаю кто и что туда пытается копировать или это какой то сбой). Вобщем нажал очистить буфер. И все заработало без перезагрузки. Есть смутные подозрения что эту ситуацию с буфером вызывает VIRTUAL PC от Microsoft.

Мне этот способ тоже помог . Правда там нет пункта очистить, я там выбрал в меню «Правка», а там «Удалить» — после этого буфер обменв приходит в чувство без перезагрузки компьютера
p.s. Но VIRTUAL PC тут и правда непричём…

0

I’ve got a WPF application using datagrid. The application worked fine until I installed Visual Studio 2012 and Blend+SketchFlow preview. Now, when I’m trying to copy the data from the grid into the clipboard with Ctrl + C (in any application), I’m getting the following exception:

System.Runtime.InteropServices.COMException (0x800401D0): OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN))
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode, IntPtr errorInfo)
   at System.Windows.Clipboard.Flush()
   at System.Windows.Clipboard.CriticalSetDataObject(Object data, Boolean copy)
   at System.Windows.Controls.DataGrid.OnExecutedCopy(ExecutedRoutedEventArgs args)
   at System.Windows.Controls.DataGrid.OnExecutedCopy(Object target, ExecutedRoutedEventArgs args)
   at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
   at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
   at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
   at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.UIElement.OnExecutedThunk(Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
   at System.Windows.Input.RoutedCommand.ExecuteCore(Object parameter, IInputElement target, Boolean userInitiated)
   at System.Windows.Input.CommandManager.TranslateInput(IInputElement targetElement, InputEventArgs inputEventArgs)
   at System.Windows.UIElement.OnKeyDownThunk(Object sender, KeyEventArgs e)
   at System.Windows.Input.KeyEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
   at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
   at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
   at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
   at System.Windows.Interop.HwndSource.OnPreprocessMessageThunk(MSG& msg, Boolean& handled)
   at System.Windows.Interop.HwndSource.WeakEventPreprocessMessage.OnPreprocessMessage(MSG& msg, Boolean& handled)
   at System.Windows.Interop.ComponentDispatcherThread.RaiseThreadMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()

This is really annoying.

I’ve seen some references to this problem here and on various locations on the web, with no real solution.

I can verify that the clipboard is locked when this exception is raised in Visual Studio, as I couldn’t copy paste the message (had to write it to a file). Also, the clipboard wasn’t locked before the copy process started.

How to solve this problem?

Автор:

Andrey337 · Опубликовано: 33 минуты назад

Здравствуйте!

Спасибо за Ваш ответ.

Я пробовал выгружать данный атрибут в Word, он не выгружается, то что показал пользователь Nek, я предполагаю является работой стилей заголовков в Word, т.к. у себя мы именно так и получаем номера в начале строки заголовка.

Я предполагал, что пользователь Nek, выгрузил их по другому, поэтому и попросил реализовать мой пример.

Так он написал, что не смотрел шаблон, то атрибут номер появился, благодаря работе стилей Word.

Спасибо, за подробное описание работы с этим атрибутом в Excel.

При помощи VBA мы у себя собираем ТЗ из того, что выгружает ТС в Word.

Меня интересовал метод именно выгрузки данного атрибута, про постройку костылей мне известно, мой код по формированию ТЗ знатный инвалид)))

Если у кого-то будут вопросы по теме выгрузки или макрсоов под Word могу подсказать.

Если вопросов по выгрузке не будет, то тему можно закрывать, т.к. программисты нашли выход.

Они решили запускать свой код, при любом изменении в структуры, которое приводит к её автоматическому сохранению.

I am running Windows 10. A few weeks ago, applications at random give me this message when I try to copy something to / from the clipboard.

Cannot open clipboard

Cannot Open Clipboard

If I reboot, then the same application works. Any ideas anyone ?

  • windows-10
  • clipboard

asked Mar 4, 2016 at 1:20

Rohit Gupta's user avatar

Rohit GuptaRohit Gupta

1,7689 gold badges19 silver badges25 bronze badges

4

  • lbview isn’t a standard application. Does this happen in Safe Mode. You clearly have an application that is causing this problem. Use Autoruns to determine which application it is

    Mar 4, 2016 at 1:50

  • That’s an example. It has nothing to do with a particular application. Different ones exhibit it at different times. None of these applications are newly installed. And they used to work fine.

    Mar 4, 2016 at 1:53

  • Do the rest of my suggestion.

    Mar 4, 2016 at 1:57

1 Answer

Repair office

  1. Run(Ctrl + R): appwiz.cpl
  2. Right click on Microsoft office
  3. Click repair
  4. Reboot and test

answered May 11, 2018 at 12:10

Maydee's user avatar

Код C#:

TextBox TBH2 = new TextBox();
TBH2.Text = "qqq"
Clipboard.Clear();
TBH2.SelectAll();
TBH2.Copy();

Clipboard.clear() выкидывает исключение COMExeption
ошибка при вызове OpenClipboard(Исключение из HRESULT: 0x800401D0(CLIPBRD_E_CANT_OPEN))»

Получается Clipboard занят другим процессом и удается до него достучаться.
Пробовал подождать, пока буфер не освободится, не помогает.

private void textCopyClipboard(TextBox textBox)
{              
  for (int i = 0; i < 100;i++)
  {
     try
     {
        Clipboard.Clear();
        textBox.SelectAll();
        textBox.Copy();                      
        return;
     }
     catch (Exception ex)
     {
        System.Threading.Thread.Sleep(100);
     }
  }
}

Подскажите плиз, как можно побороть эту проблему.

23.09.09 00:25: Перенесено модератором из ‘.NET’ — TK

Здравствуйте, Кирилл Осенков, Вы писали:

КО>[STAThread] на точке входа стоит?

WPF по умолчанию выполняется в [STAThread].

А>WPF по умолчанию выполняется в [STAThread].
Прошу прощения, коллега, мой телепатический модуль сейчас в ремонте. Без него мне неясно, используется ли в исходном сообщении WinForms или WPF.

Кроме того можно посоветовать привести полный mixed-mode call stack для главного потока с загруженными символами. Интересно, что происходит в native code frames, может поймать native first chance exception до того, как оно HRESULT вернёт и отмотает стек.

Здравствуйте, serjik007, Вы писали:

S>ошибка при вызове OpenClipboard(Исключение из HRESULT: 0x800401D0(CLIPBRD_E_CANT_OPEN))»


S>Получается Clipboard занят другим процессом и удается до него достучаться.

S>Пробовал подождать, пока буфер не освободится, не помогает.

S>Подскажите плиз, как можно побороть эту проблему.

Код твой вставил в WPF приложение прямо в конструктор Windows1, где он и сработал без проблем. Дело не в коде. Судя по всему , у тебя что-то именно с клипбоард не то. Проверь работу ее вручную, то есть забрось туда какой-нибудь текст и убедись, что он там есть.

Если некоторое приложение вызвало OpenClipboard и не вызвало CloseClipboard, clipboard будет недоступна всем другим приложениям.

Why does the following code sometimes causes an Exception with the contents «CLIPBRD_E_CANT_OPEN»:

Clipboard.SetText(str);

This usually occurs the first time the Clipboard is used in the application and not after that.

2

This is caused by a bug/feature in Terminal Services clipboard (and possible other things) and the .NET implementation of the clipboard. A delay in opening the clipboard causes the error, which usually passes within a few milliseconds.

The solution is to try multiple times within a loop and sleep in between.

for (int i = 0; i < 10; i++)
{
    try
    {
        Clipboard.SetText(str);
        return;
    }
    catch { }
    System.Threading.Thread.Sleep(10);
} 

Jason Plank's user avatar

Jason Plank

2,3424 gold badges32 silver badges40 bronze badges

answered Sep 16, 2008 at 3:07

Robert Wagner's user avatar

Robert WagnerRobert Wagner

17.3k8 gold badges56 silver badges71 bronze badges

5

Actually, I think this is the fault of the Win32 API.

To set data in the clipboard, you have to open it first. Only one process can have the clipboard open at a time. So, when you check, if another process has the clipboard open for any reason, your attempt to open it will fail.

It just so happens that Terminal Services keeps track of the clipboard, and on older versions of Windows (pre-Vista), you have to open the clipboard to see what’s inside… which ends up blocking you. The only solution is to wait until Terminal Services closes the clipboard and try again.

It’s important to realize that this is not specific to Terminal Services, though: it can happen with anything. Working with the clipboard in Win32 is a giant race condition. But, since by design you’re only supposed to muck around with the clipboard in response to user input, this usually doesn’t present a problem.

Patrick Hofman's user avatar

answered Sep 16, 2008 at 2:21

Tadmas's user avatar

I know this question is old, but the problem still exists. As mentioned before, this exception occurs when the system clipboard is blocked by another process. Unfortunately, there are many snipping tools, programs for screenshots and file copy tools which can block the Windows clipboard. So you will get the exception every time you try to use Clipboard.SetText(str) when such a tool is installed on your PC.

Solution:

never use

Clipboard.SetText(str);

use instead

Clipboard.SetDataObject(str);

3

I solved this issue for my own app using native Win32 functions: OpenClipboard(), CloseClipboard() and SetClipboardData().

Below the wrapper class I made. Could anyone please review it and tell if it is correct or not. Especially when the managed code is running as x64 app (I use Any CPU in the project options). What happens when I link to x86 libraries from x64 app?

Thank you!

Here’s the code:

public static class ClipboardNative
{
    [DllImport("user32.dll")]
    private static extern bool OpenClipboard(IntPtr hWndNewOwner);

    [DllImport("user32.dll")]
    private static extern bool CloseClipboard();

    [DllImport("user32.dll")]
    private static extern bool SetClipboardData(uint uFormat, IntPtr data);

    private const uint CF_UNICODETEXT = 13;

    public static bool CopyTextToClipboard(string text)
    {
        if (!OpenClipboard(IntPtr.Zero)){
            return false;
        }

        var global = Marshal.StringToHGlobalUni(text);

        SetClipboardData(CF_UNICODETEXT, global);
        CloseClipboard();

        //-------------------------------------------
        // Not sure, but it looks like we do not need 
        // to free HGLOBAL because Clipboard is now 
        // responsible for the copied data. (?)
        //
        // Otherwise the second call will crash
        // the app with a Win32 exception 
        // inside OpenClipboard() function
        //-------------------------------------------
        // Marshal.FreeHGlobal(global);

        return true;
    }
}

3

Actually there could be another issue at hand. The framework call (both the WPF and winform flavors) to something like this (code is from reflector):

private static void SetDataInternal(string format, object data)
{
    bool flag;
    if (IsDataFormatAutoConvert(format))
    {
        flag = true;
    }
    else
    {
        flag = false;
    }
    IDataObject obj2 = new DataObject();
    obj2.SetData(format, data, flag);
    SetDataObject(obj2, true);
}

Note that SetDataObject is always called with true in this case.

Internally that triggers two calls to the win32 api, one to set the data and one to flush it from your app so it’s available after the app closes.

I’ve seen several apps (some chrome plugin, and a download manager) that listen to the clipboard event. As soon as the first call hits, the app will open the clipboard to look into the data, and the second call to flush will fail.

Haven’t found a good solution except to write my own clipboard class that uses direct win32 API or to call setDataObject directly with false for keeping data after the app closes.

This happen to me in my WPF application. I got OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN)).

i use

ApplicationCommands.Copy.Execute(null, myDataGrid);

solution is to clear the clipboard first

Clipboard.Clear();
ApplicationCommands.Copy.Execute(null, myDataGrid);

1

The difference between Cliboard.SetText and Cliboard.SetDataObject in WPF is that the text is not copied to the clipboard, only the pointer. I checked the source code. If we call SetDataObject(data, true) Clipoard.Flush() will also be called. Thanks to this, text or data is available even after closing the application. I think Windows applications only call Flush() when they are shutting down. Thanks to this, it saves memory and at the same time gives access to data without an active application.

Copy to clipboard:

IDataObject CopyStringToClipboard(string s)
{
  var dataObject = new DataObject(s);
  Clipboard.SetDataObject(dataObject, false);
  return dataObject;
}

Code when app or window is closed:

try
{
  if ((clipboardData != null) && Clipboard.IsCurrent(clipboardData))
    Clipboard.Flush();
}
catch (COMException ex) {}

clipboardData is a window class field or static variable.

That’s not a solution, just some additional information on how to reproduce it when all solutions work on your PC and fail somewhere else. As mentioned in the accepted answer — clipboard can be busy by some other app. You just need to handle this failure properly, to explain user somehow why it does not work.

So, just create a new console app with few lines below and run it. And while it is running — test your primary app on how it is handles busy clipboard:

using System;
using System.Runtime.InteropServices;

namespace Clipboard
{
    class Program
    {
        [DllImport("user32.dll")]
        private static extern bool OpenClipboard(IntPtr hWndNewOwner);

        [DllImport("user32.dll")]
        private static extern bool CloseClipboard();

        static void Main(string[] args)
        {
            bool res = OpenClipboard(IntPtr.Zero);
            Console.Write(res);
            Console.Read();
            CloseClipboard();
        }
    }
}

Произошла исключительная ситуация: Ошибка при вызове OpenClipboard

{InfostartToolkitPROF ОбщийМодуль.ИТК_БуферОбменаКлиент.Модуль(42)}:	Возврат htmlfile.ParentWindow.ClipboardData.Getdata("Text");
{InfostartToolkitPROF ОбщийМодуль.ИТК_БуферОбменаКлиент.Модуль(13)}:	Если Текст = Текст() Тогда
{InfostartToolkitPROF Обработка.ИТК_КонсольРазработчика.Форма.КодНаВстроенномЯзыке.Форма(204)}:	ИТК_БуферОбменаКлиент.Копировать(Текст);

по причине:
Произошла исключительная ситуация: Ошибка при вызове OpenClipboard

Конфигурация:
Бух + Бит.Финанс (3.0.108.36/3.1.51.6)
Основной режим запуска: Управляемое приложение
Режим совместимости: Версия8_3_16
Версия БСП: 3.1.5.306

Клиент:
ОС: Windows x86 (Microsoft Windows 10 version 10.0 (Build 19044))
Язык: ru
Режим запуска: Управляемое приложение

87 / 66 / 8

Регистрация: 29.09.2009

Сообщений: 425

1

Ошибка при чтении данных из буфера обмена

01.12.2010, 16:10. Показов 25193. Ответов 9


Студворк — интернет-сервис помощи студентам

Доброго вермени суток.На ПК стоит WIN XP SP2. С недавних пор стал замечать что тупит буфер обмена.Т.е. после копирования(файла, текста) недоступен пункт меню «вставить». Ctrl+V тоже не срабатывает(просто ничего не происходит). В Paint попытка «вставить» приводит к ошибке: «Ошибка при чтении даных из буфера обмена». А в DownloadMaster попытка добавить новую закачку приводит к ошибке «Cannot open clipboard». Проблема возникает спонтанно и пока решается перезагрузкой. Кто что может посоветовать уважаемые форумчане? На вирусы проверял касперским, вроде ниче не нашел…



0



Почетный модератор

14005 / 3624 / 87

Регистрация: 11.06.2009

Сообщений: 11,783

01.12.2010, 19:27

2

попробуйте пообщаться с программкой clipbrd.exe из папки Windows/system32…
там можно и смотреть и чистить буфер …
Для того чтобы очистить буфер обмена необходимо запустить уже известный нам файл и нажать на крестик либо «Правка – Удалить».
Да..еще может память протестировать попробовать..



2



87 / 66 / 8

Регистрация: 29.09.2009

Сообщений: 425

01.12.2010, 21:25

 [ТС]

3

Спасибо, прикольная штука «clipbrd.exe» сколько лет на винде сижу не знал даже. А память проверю, завтра отпишусь.



0



Почетный модератор

14005 / 3624 / 87

Регистрация: 11.06.2009

Сообщений: 11,783

01.12.2010, 21:40

4

Джуниор, признаюсь по секрету, только -чур никому, лады ? Если бы не Ваш вопрос, я бы тоже не узнал про этот встроенный утиль винды Ну ни к чему было



0



magirus

01.12.2010, 21:41

Не по теме:

Цитата
Сообщение от Almiqui
Посмотреть сообщение

я бы тоже не узнал про этот встроенный утиль винды

я про него уже забыть успел… :)



0



87 / 66 / 8

Регистрация: 29.09.2009

Сообщений: 425

08.12.2010, 15:20

 [ТС]

6

Лучший ответ Сообщение было отмечено vavun как решение

Решение

Сегодня наконец то повторилась проблема, которая описывается выше. Как и посоветовал Almiqui
запустил системную утилиту clipbrd.exe. Открывался долго долго и накнец руганулся что размер объекта буфера слишком велик(не знаю кто и что туда пытается копировать или это какой то сбой). Вобщем нажал очистить буфер. И все заработало без перезагрузки. Есть смутные подозрения что эту ситуацию с буфером вызывает VIRTUAL PC от Microsoft.



1



32 / 32 / 2

Регистрация: 06.07.2010

Сообщений: 129

03.01.2012, 23:53

7

У меня тоже эта проблема наблюдается. Однако нет никакого VIRTUAL PC. Значит не в нем дело.



0



680 / 330 / 5

Регистрация: 01.03.2010

Сообщений: 1,387

04.01.2012, 10:12

8

1. увеличить файл подкачки
2. сделать дефрагментацию HDD
3. прогнать память memtest’ом
4. почистить системный диск от мусора
5. временно удалить касперского
6. проверить систему на вирусяки утилиткой AVZ



0



295 / 209 / 67

Регистрация: 08.11.2010

Сообщений: 1,823

02.11.2015, 07:59

9

Была у меня такая проблема недавно, во всем был виноват Скайп.



0



1 / 1 / 0

Регистрация: 14.10.2012

Сообщений: 6

26.02.2016, 18:12

10

Цитата
Сообщение от Джуниор
Посмотреть сообщение

Сегодня наконец то повторилась проблема, которая описывается выше. Как и посоветовал Almiqui
запустил системную утилиту clipbrd.exe. Открывался долго долго и накнец руганулся что размер объекта буфера слишком велик(не знаю кто и что туда пытается копировать или это какой то сбой). Вобщем нажал очистить буфер. И все заработало без перезагрузки. Есть смутные подозрения что эту ситуацию с буфером вызывает VIRTUAL PC от Microsoft.

Мне этот способ тоже помог . Правда там нет пункта очистить, я там выбрал в меню «Правка», а там «Удалить» — после этого буфер обменв приходит в чувство без перезагрузки компьютера
p.s. Но VIRTUAL PC тут и правда непричём…



0



I have a simple WPF app which creates a Thread, polls the clipboard every second and trims any strings it finds

However, in the background thread, once the string content changes, the clipboard methods fail with the exception

OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN))

Example: I have «ABC» on my clipboard and launch the app. A messagebox will popup with the string ABC. Now I copy a string «DEF» and instead of a message box popping up, the application crashes with the above error

public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
            Thread t = new Thread(new ThreadStart(cleanStr));
            t.SetApartmentState(ApartmentState.STA);
            t.Start();
        }
        void cleanStr()
        {
            string prevStr = "";
            int err = 0;
            while (true)
            {
                    if (Clipboard.ContainsText() && !prevStr.Equals(Clipboard.GetText()))
                    {
                        prevStr = Clipboard.GetText();
                        prevStr=prevStr.Trim();
                        Clipboard.SetText(prevStr);
                        MessageBox.Show(prevStr);
                        Thread.Sleep(1000);
                    }
            }
        }

I’ve got a WPF application using datagrid. The application worked fine until I installed Visual Studio 2012 and Blend+SketchFlow preview. Now, when I’m trying to copy the data from the grid into the clipboard with Ctrl + C (in any application), I’m getting the following exception:

System.Runtime.InteropServices.COMException (0x800401D0): OpenClipboard Failed (Exception from HRESULT: 0x800401D0 (CLIPBRD_E_CANT_OPEN))
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHRInternal(Int32 errorCode, IntPtr errorInfo)
   at System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(Int32 errorCode, IntPtr errorInfo)
   at System.Windows.Clipboard.Flush()
   at System.Windows.Clipboard.CriticalSetDataObject(Object data, Boolean copy)
   at System.Windows.Controls.DataGrid.OnExecutedCopy(ExecutedRoutedEventArgs args)
   at System.Windows.Controls.DataGrid.OnExecutedCopy(Object target, ExecutedRoutedEventArgs args)
   at System.Windows.Input.CommandBinding.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.Input.CommandManager.ExecuteCommandBinding(Object sender, ExecutedRoutedEventArgs e, CommandBinding commandBinding)
   at System.Windows.Input.CommandManager.FindCommandBinding(CommandBindingCollection commandBindings, Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
   at System.Windows.Input.CommandManager.FindCommandBinding(Object sender, RoutedEventArgs e, ICommand command, Boolean execute)
   at System.Windows.Input.CommandManager.OnExecuted(Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.UIElement.OnExecutedThunk(Object sender, ExecutedRoutedEventArgs e)
   at System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(Delegate genericHandler, Object target)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.RoutedCommand.ExecuteImpl(Object parameter, IInputElement target, Boolean userInitiated)
   at System.Windows.Input.RoutedCommand.ExecuteCore(Object parameter, IInputElement target, Boolean userInitiated)
   at System.Windows.Input.CommandManager.TranslateInput(IInputElement targetElement, InputEventArgs inputEventArgs)
   at System.Windows.UIElement.OnKeyDownThunk(Object sender, KeyEventArgs e)
   at System.Windows.Input.KeyEventArgs.InvokeEventHandler(Delegate genericHandler, Object genericTarget)
   at System.Windows.RoutedEventArgs.InvokeHandler(Delegate handler, Object target)
   at System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target, RoutedEventArgs routedEventArgs)
   at System.Windows.EventRoute.InvokeHandlersImpl(Object source, RoutedEventArgs args, Boolean reRaised)
   at System.Windows.UIElement.RaiseEventImpl(DependencyObject sender, RoutedEventArgs args)
   at System.Windows.UIElement.RaiseTrustedEvent(RoutedEventArgs args)
   at System.Windows.UIElement.RaiseEvent(RoutedEventArgs args, Boolean trusted)
   at System.Windows.Input.InputManager.ProcessStagingArea()
   at System.Windows.Input.InputManager.ProcessInput(InputEventArgs input)
   at System.Windows.Input.InputProviderSite.ReportInput(InputReport inputReport)
   at System.Windows.Interop.HwndKeyboardInputProvider.ReportInput(IntPtr hwnd, InputMode mode, Int32 timestamp, RawKeyboardActions actions, Int32 scanCode, Boolean isExtendedKey, Boolean isSystemKey, Int32 virtualKey)
   at System.Windows.Interop.HwndKeyboardInputProvider.ProcessKeyAction(MSG& msg, Boolean& handled)
   at System.Windows.Interop.HwndSource.CriticalTranslateAccelerator(MSG& msg, ModifierKeys modifiers)
   at System.Windows.Interop.HwndSource.OnPreprocessMessage(Object param)
   at System.Windows.Threading.ExceptionWrapper.InternalRealCall(Delegate callback, Object args, Int32 numArgs)
   at MS.Internal.Threading.ExceptionFilterHelper.TryCatchWhen(Object source, Delegate method, Object args, Int32 numArgs, Delegate catchHandler)
   at System.Windows.Threading.Dispatcher.LegacyInvokeImpl(DispatcherPriority priority, TimeSpan timeout, Delegate method, Object args, Int32 numArgs)
   at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
   at System.Windows.Interop.HwndSource.OnPreprocessMessageThunk(MSG& msg, Boolean& handled)
   at System.Windows.Interop.HwndSource.WeakEventPreprocessMessage.OnPreprocessMessage(MSG& msg, Boolean& handled)
   at System.Windows.Interop.ComponentDispatcherThread.RaiseThreadMessage(MSG& msg)
   at System.Windows.Threading.Dispatcher.PushFrameImpl(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.PushFrame(DispatcherFrame frame)
   at System.Windows.Threading.Dispatcher.Run()
   at System.Windows.Application.RunDispatcher(Object ignore)
   at System.Windows.Application.RunInternal(Window window)
   at System.Windows.Application.Run(Window window)
   at System.Windows.Application.Run()

This is really annoying.

I’ve seen some references to this problem here and on various locations on the web, with no real solution.

I can verify that the clipboard is locked when this exception is raised in Visual Studio, as I couldn’t copy paste the message (had to write it to a file). Also, the clipboard wasn’t locked before the copy process started.

How to solve this problem?

Понравилась статья? Поделить с друзьями:
  • Ошибка при вызове конструктора сомобъект 2147221005 0x800401f3
  • Ошибка при вызове openclipboard paint
  • Ошибка при вызове конструктора сертификаткриптографии
  • Ошибка при вызове openclipboard corel
  • Ошибка при вызове конструктора реквизитформы