Thursday, April 12, 2012 1:26 PM
I use WRL method for file access.
However, now I usually OpenAsync() failed.
Because [operation->GetResults(&PanoramaFile)] usually get null pointer. (Sometimes it's ok!)
The code is as below.
// Call CreteFileAsync
__FIAsyncOperation_1_Windows__CStorage__CStorageFile_t * operation;
hr = pStorageFolder->CreateFileAsync(hstrFileName.Get(),
__RPC__deref_out_opt __FIAsyncOperation_1_Windows__CStorage__CStreams__CIRandomAccessStream *RandomStream;
Thursday, April 12, 2012 10:27 PMModerator
The problem is that the results aren't ready. CreateFileAsync is an asynchronous function and will take some time to complete. You cannot get the results until it has completed.
See Asynchronous programming in C++ for more information on how to handle asynchronous calls.