Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7416103
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T07:25:22+00:00 2026-05-29T07:25:22+00:00

I am having a problem regarding clipboard and I get this error message every

  • 0

I am having a problem regarding clipboard and I get this error message every time I try to make a copy / paste operation from an Excel file.

The code breaks at Clipboard.GetDataObject() and the message error is this:

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

My WPF application is already running when I open Excel, write some text and then try to copy / paste.

The code that I’m using is this:

private void SetClipboardData()
{
    IDataObject data = Clipboard.GetDataObject();
    IList result = GetDataForFileDropFormat( data );

    if ( ( result != null ) && ( result.Count > 0 ) )
    {
        this._elementsClipboard = result;
        this._sourceDrag = null;
        this._sourceClipboard = null;
    }
}

The above function is called in this handler method:

public void Handle_WM_DRAWCLIPBOARD( IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled )
{
    SendMessage( this._nextClipboardViewer, msg, wParam, lParam );

    // get data from clipboard
    SetClipboardData();

    handled = true;
}

I have been searching MSDN and .NET forums, but didn’t find a workaround for this issue.

Could someone help me with that or give me an idea of what should I try?

Thanks!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T07:25:24+00:00Added an answer on May 29, 2026 at 7:25 am

    A couple of issues here. Fist, while you definitely DO need to send the WM_DrawClipboard to the next app in the chain, you don’t need to do it FIRST. You can do it after you run your own stuff, THEN pass the message along.

    Next, don’t expect Excel to perform all of its clipboard updating in one operation. I have seen Excel perform as many as 24 updates in a row, when copying complex objects. (particularly graphs – they’d open/close the clipboard after adding each individual format).

    Also, Excel takes advantage of Delayed Rendering for almost everything besides plain text. So while your app is requesting data, Excel has render it. That can take time.

    You may need to implement a delay with a “while not success or 3-strikes loop”. You’ll need to pay close attention to whether you send the WM_DrawClipboard down the chain before or after your processing though, as you may be setting up another collision with other clipboard viewers who are also interested in Excel data, and have to resort to such tricks themselves.

    And you thought this would be easy…..

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Im having a problem regarding installing ADT plugin on Eclipse. the error prompt was
I have a problem regarding this query. I want to get the applicant latest
I am having the same problem as this thread regarding twilio-python : twilio.rest missing
Additional questions regarding SilentGhost's initial answer to a problem I'm having parsing Twitter RSS
I am having a problem regarding a Log Searching Speed and Disk Size. It
I am having a problem regarding a jquery dropdownmenu. I have put a slidedown
Having a strange problem regarding the postback of a form I've created. The answer
i am facing a problem regarding the thread. I am having a class which
I'm having a problem with Eclipse and the content assistant regarding Hibernate. As far
I have a question this time around regarding the Android custom camera, NOT the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.