Answered by:
How to solve that SaveToWICFile() return General access denied error ? (Win 8.0 APP DirectX C++/Cx)

Question
-
My purpose get DirectX screen picture in Win 8.0 app( Using C++/CX)
Using CaptureTexture and SaveToWICFile to finish this function.
DirectX::CaptureTexture return S_OK.
Then, Running SaveToWICFile return General access denied error .
I miss something?
Below my Code
DirectX::ScratchImage DxImage;
HRESULT hr_0 = DirectX::CaptureTexture( m_d3dDevice.Get() , m_d3dContext.Get() , depthStencil.Get() , DxImage );
const Image* img = DxImage.GetImages();
HRESULT hr = SaveToWICFile( *img, DirectX::WIC_FLAGS_NONE , GUID_ContainerFormatJpeg , L"C:\\Users\\StevenHuang\\Documents\\output_tex.jpg", NULL );
if ( FAILED(hr) )
{
;// error
}Monday, January 27, 2014 9:42 AM
Answers
-
Windows Store apps have limited access to file locations.
See File access and permissions in Windows Store apps on MSDN.
You generally can only write new files to :
auto folder = Windows::Storage::ApplicationData::Current->LocalFolder; // use folder->Path->Data() as the path base
Note that there are some details on the DirectXTex and DirectXTK documentation wikis for these issues. You may also find the discussion forums on the CodePlex a better place to ask specific questions about DircectXTex or DirectXTK.- Proposed as answer by Chuck Walbourn - MSFTMicrosoft employee Monday, January 27, 2014 7:25 PM
- Edited by Chuck Walbourn - MSFTMicrosoft employee Monday, January 27, 2014 7:26 PM
- Marked as answer by KC-Steven Monday, January 27, 2014 11:56 PM
- Unmarked as answer by KC-Steven Tuesday, January 28, 2014 2:34 AM
- Marked as answer by KC-Steven Tuesday, January 28, 2014 2:59 AM
Monday, January 27, 2014 7:25 PM
All replies
-
Windows Store apps have limited access to file locations.
See File access and permissions in Windows Store apps on MSDN.
You generally can only write new files to :
auto folder = Windows::Storage::ApplicationData::Current->LocalFolder; // use folder->Path->Data() as the path base
Note that there are some details on the DirectXTex and DirectXTK documentation wikis for these issues. You may also find the discussion forums on the CodePlex a better place to ask specific questions about DircectXTex or DirectXTK.- Proposed as answer by Chuck Walbourn - MSFTMicrosoft employee Monday, January 27, 2014 7:25 PM
- Edited by Chuck Walbourn - MSFTMicrosoft employee Monday, January 27, 2014 7:26 PM
- Marked as answer by KC-Steven Monday, January 27, 2014 11:56 PM
- Unmarked as answer by KC-Steven Tuesday, January 28, 2014 2:34 AM
- Marked as answer by KC-Steven Tuesday, January 28, 2014 2:59 AM
Monday, January 27, 2014 7:25 PM -
Thank you very much ^^. My problem had solved.Tuesday, January 28, 2014 3:00 AM