我想获取有关用户使用FileOpenPicker选择的文件的某些文件信息,但所有信息(如路径和名称)均为空。当我尝试查看对象的断点我得到了以下信息:Windows 8应用程序FileOpenPicker np文件信息
文件= 0x03489cd4 <没有资料,没有加载shell32.dll中的符号>
我用下面的代码调用FileOpenPicker和HANDELING文件
#include "pch.h"
#include "LocalFilePicker.h"
using namespace concurrency;
using namespace Platform;
using namespace Windows::Storage;
using namespace Windows::Storage::Pickers;
const int LocalFilePicker::AUDIO = 0;
const int LocalFilePicker::VIDEO = 1;
const int LocalFilePicker::IMAGES = 2;
LocalFilePicker::LocalFilePicker()
{
_init();
}
void LocalFilePicker::_init()
{
_openPicker = ref new FileOpenPicker();
_openPicker->ViewMode = PickerViewMode::Thumbnail;
}
void LocalFilePicker::askFile(int categorie)
{
switch (categorie)
{
case 0:
break;
case 1:
_openPicker->SuggestedStartLocation = PickerLocationId::VideosLibrary;
_openPicker->FileTypeFilter->Append(".mp4");
break;
case 2:
break;
default:
break;
}
create_task(_openPicker->PickSingleFileAsync()).then([this](StorageFile^ file)
{
if (file)
{
int n = 0;
wchar_t buf[1024];
_snwprintf_s(buf, 1024, _TRUNCATE, L"Test: '%s'\n", file->Path);
OutputDebugString(buf);
}
else
{
OutputDebugString(L"canceled");
}
});
}
任何人都可以看到什么是错的代码或一些问题,为应用程序为什么不能得到预期的工作环境中。
感谢您的回答,这正是我一直在寻找的。 – furrie 2014-11-10 17:22:28