从 FutureAccessList 同步获取文件夹路径
Get Folder Path Synchronously from FutureAccessList
我使用FolderPicker在FutureAccessList中存储了许多文件夹。出于日志记录/配置目的,我希望能够枚举这些并将其完整路径打印为字符串。
我已经编写了下面的代码来尝试帮助解决这个问题,但它不断抛出以下内容:
Unhandled exception at 0x0355CAB6 (ucrtbased.dll) in foo.exe: An invalid
parameter was passed to a function that considers invalid parameters fatal.
这是代码,如果有人能告诉我哪里出错了,我将不胜感激。真的我想以同步方式执行 GetFolderAsync 函数,即 exec-wait-return。我确定有一个简单的答案,但我只是在加快C++/UWP 编程的速度,这些编程具有其他语言的背景!
String^ MainPage::GetFolderPathForKey(String^ key)
{
task<String^> t = create_task(
StorageApplicationPermissions::FutureAccessList->GetFolderAsync(key))
.then([](StorageFolder^ folder)
{
if (folder != nullptr) {
return folder->Name;
}
return ref new String(L"Unknown?");
});
String^ taskResult = t.get();
return taskResult;
}
问题是由于在 UI 线程中尝试 get((/wait(( 引起的。
相关文章:
- 如何将更多文件夹添加到c++include路径
- [android ndk]如何获取资产文件夹中文件的绝对路径?
- 获取 exe 文件夹路径的最佳方法?
- cmake find_package CMakeLists.txt 子文件夹中的相对路径
- 从 FutureAccessList 同步获取文件夹路径
- 如何将用于创建文件的文件的路径提供给C++中的其他文件夹
- Boost Filesystem flowly_caronical不会在没有父文件夹的情况下解决相对路径
- C/C++ 从根位置搜索文件夹并返回绝对路径
- C++ 程序 [窗口] 的资产文件夹路径
- 如何获取哪些快捷方式和文件在桌面等文件夹路径中突出显示
- 通过浏览按钮仅获取文件夹路径
- KQUEUE 仅适用于文件夹路径
- Windows 8:如何以编程方式读取用户文档文件夹路径(使用 c)
- 在Windows运行时组件中使用WRL获取文件夹路径返回空字符串
- SHGetFolderPath 已弃用:检索 Windows 文件夹路径的替代方法是什么
- 获取用户临时文件夹路径 c++
- Windows主页-SHGet(已知)文件夹路径
- 外壳扩展DLL-如果用户在文件夹空白区域内单击,如何捕获文件夹路径
- 文件夹路径序列化的最大字符长度
- 检查文件夹路径