Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/138.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何在C+上执行与C#async wait相同的操作+/WRL_C#_C++_Asynchronous_Wrl - Fatal编程技术网

如何在C+上执行与C#async wait相同的操作+/WRL

如何在C+上执行与C#async wait相同的操作+/WRL,c#,c++,asynchronous,wrl,C#,C++,Asynchronous,Wrl,我正在尝试c++/WRL,但基本操作失败,主要是调用异步函数并获取结果,例如如何获取由以下代码返回的IStorageFile: HString path; path.Set(L"C:\\somepath\\somefile.txt"); // Get the Activation Factory ComPtr<IActivationFactory> pStorageFileActivationFactory; hr = GetActivationFactory(HStringRef

我正在尝试c++/WRL,但基本操作失败,主要是调用异步函数并获取结果,例如如何获取由以下代码返回的IStorageFile:

HString path;
path.Set(L"C:\\somepath\\somefile.txt");

// Get the Activation Factory
ComPtr<IActivationFactory> pStorageFileActivationFactory;
hr = GetActivationFactory(HStringReference(RuntimeClass_Windows_Storage_StorageFile).Get(), &pStorageFileActivationFactory);
if (FAILED(hr))
{
    return PrintError(__LINE__, hr);
}
ComPtr<IStorageFileStatics> pStorageFileStatics;
hr = pStorageFileActivationFactory.As(&pStorageFileStatics);

__FIAsyncOperation_1_Windows__CStorage__CStorageFile* filePathStorage;
hr = pStorageFileStatics->GetFileFromPathAsync(path.Get(), &filePathStorage);
hs字符串路径;
Set(L“C:\\somepath\\somefile.txt”);
//获取激活工厂
ComPtr pStorageFileActivationFactory;
hr=GetActivationFactory(HStringReference(RuntimeClass\u Windows\u Storage\u StorageFile).Get(),&pStorageFileActivationFactory);
如果(失败(小时))
{
返回打印错误(_行,hr);
}
ComPtr pStorageFileStatics;
hr=pStorageFileActivationFactory.As(&pStorageFileStatics);
__FIAsyncOperation_1_Windows__CStorage__CStorageFile*文件路径存储;
hr=pStorageFileStatics->GetFileFromPathAsync(path.Get(),&filePathStorage);
如何执行filePathStorage IAsyncOperation对象?如何在c++/WRL中实现这一点