简体   繁体   中英

Windows 8 store app C++ file access

I'm working on a Windows 8 store app which uses C# for the GUI and C++ (as another project in the same solution, set to make a DLL) for image processing and am trying to open a .png image in the C++ from a path specified from the C#. This works fine when the images are located in the Apps asset folder ie .\\\\Assets\\\\image.png but when I try to access an image in the Pictures library I get E_ACCESSDENIED in the C++ code. I have specified the Documents and Pictures library capabilities in the c# project manifest but the C++ still gets access denied. Anyone know how to give the C++ code access rights to certain folders?

eg calling the function defined in wincodec.h, if 'filename' is somthing like "C:\\Users\\Name\\Pictures\\image0.png" hr will have the result E_ACCESSDENIED

if (SUCCEEDED(hr))
{
    hr = pFactory->CreateDecoderFromFilename(
        filename,
        NULL,
        GENERIC_READ,
        WICDecodeMetadataCacheOnDemand,
        &pDecoder);


}

when I try to access an image in the Pictures library I get E_ACCESSDENIED

Yes, that's a feature. You need to declare the picturesLibrary capability in your application's manifest to be allowed access to the pictures library.

See this post for more details.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM