IWICStream::InitializeFromFilename returns E_ACCESSDENIED RRS feed

  • Question

  • I called ScreenGrab function of DirectXTK from my app and always get an E_ACCESSDENIED (General access denied error) for the statement

        hr = stream->InitializeFromFilename( fileName, GENERIC_WRITE );

    in line ScreenGrab.cpp:658. The saved file is in the Pictures Library and I've declared the "Picture Library" capabilities in Package.appxmanifest. Could some one point out where is wrong, thanks.

    Tuesday, November 6, 2012 2:23 PM

All replies

  • Hi,

    What's the error message? You can use GetLastError to get it. If the error is file does not exist, you should check if the file is in the sample folder with yourapp.exe, which in the output folder.

    Best regards,

    Jesse Jiang [MSFT]
    MSDN Community Support | Feedback to us

    Wednesday, November 7, 2012 7:28 AM
  • You should change image file's attribute.

    click the Image  -> choose the image attribute -> Advance -> file attribute -- File is ready for archiving. Don't check this item.

    Try it.

    Wednesday, November 7, 2012 7:50 AM
  • The error message is "General access denied". As I want to save the screenshot to an image file, it does not matter whether the to-be-saved file exist or not. The output folder is the "Picture Library".
    Wednesday, November 7, 2012 2:50 PM