locked
Exception : exception: 0x80070005(ERROR_ACCESS_DENIED) - Access is denied : CLIPBOARD

    Question

  • Hi,

    I have written Code for Copying text to clipboard.

    I am getting an exception "Exception : exception: 0x80070005(ERROR_ACCESS_DENIED) - Access is denied." when I do this operation while "Charm" is opened.

    That too this occurs in when I run through package , where as it is working fine when I run it through Visual Studio

    Can anyone help me why this happens ? what happens when charm is opened ?

    CODE SNIPPET :

    try
    {

    Platform::String^ Str= "Hello World!";

    auto dataPackage = ref new DataPackage();
        // Set the content as CF_TEXT text format.
        dataPackage->SetText(Str);
              Windows::ApplicationModel::DataTransfer::Clipboard::SetContent(dataPackage);
        
          
       }
      }
      catch(Exception^ e)
      {
       //Exception : exception: 0x80070005(ERROR_ACCESS_DENIED) - Access is denied.


      }
      catch(std::exception& ex)
      {
        //Exception
      }

    Monday, March 18, 2013 10:22 AM

All replies

  • This sounds like correct behavior. The app can access the clipboard only when it is in the foreground. If the user is interacting with the charms then they will be in the foreground.

    Why are you trying to modify the clipboard when a charm is active? What is the goal you are trying to achieve here?

    --Rob

    Monday, March 18, 2013 11:13 PM
    Owner
  • Hi Rob,

    In Actual , I am trying to get a link from server and then copy to clipboard.

    During the above process , when I try to use (Win + C) to open charms ,the copy to clipboard is not working. where as when I open the charm using mouse(i.e moving mouse to the extreme right to screen) copy to clipboard is working fine.

    Can I know why it is working such a way ?

    does (Win + C) command on keyboard use CLIPBOARD ?

    Tuesday, March 19, 2013 9:11 AM