auto task = create_task(Windows::Storage::KnownFolders::PicturesLibrary->GetFilesAsync(Windows::Storage::Search::CommonFileQuery::OrderBySearchRank));
task.then([&sstrpath](Windows::Foundation::Collections::IVectorView<Windows::Storage::StorageFile^>^ files)
{
CCLog("num of files detected %d",files->Size);
Platform::String^ pathstr = files->GetAt(0)->Path;
OutputDebugStringW(pathstr->Data());
auto task2 = create_task(files->GetAt(0)->OpenAsync(Windows::Storage::FileAccessMode::Read));
task2.then([](Windows::Storage::Streams::IRandomAccessStream^ filestream)
{
Windows::UI::Xaml::Media::Imaging::BitmapImage^ bmp = ref new Windows::UI::Xaml::Media::Imaging::BitmapImage();
bmp->SetSource(filestream);
}
);
}
);
이것은 C++ (cocos2dx 프레임 워크)의 VS express RTM이있는 Win8 RTM에서 수행되었습니다. 그림 라이브러리에서 이미지를로드하고 그 중 BitmapImage를 만들려고합니다. 다음은 cococs2dx에서 BitmapImage를 CCSprite 용으로 사용하는 것이었지만 여기서는 문제가 아닙니다. 이 프로그램은 task2로 진행할 수 있었지만 BitmmapImage를 새로 참조하려고 할 때 충돌이 발생했습니다. 다음은 내가 Win8 응용 프로그램 개발을위한 기반 자바 스크립트 또는 XAML 거기에서 내가 가장 튜토리얼로 잘못 한 일을 정말 잘 모르겠습니다 출력 콘솔KnownFolders에서 BitmapImage로 이미지로드
First-chance exception at 0x75004B32 in myGame.exe: Microsoft C++ exception:
Platform::WrongThreadException^at memory location 0x02D1D794. HRESULT:0x8001010E
First-chance exception at 0x75004B32 in myGame.exe: Microsoft C++ exception: [rethrow] at memory location 0x00000000.
First-chance exception at 0x75004B32 in myGame.exe: Microsoft C++ exception:
Platform::WrongThreadException^at memory location 0x02D1E5F0. HRESULT:0x8001010E
Unhandled exception at 0x622C9AD1 (msvcr110d.dll) in PixBlitz.exe: An invalid parameter was passed to a function that considers invalid parameters fatal.
했다.
앱에 해당 파일 위치 및 파일 형식에 대한 액세스 권한이 있습니까? – mydogisbox
예, 그렇지 않으면 실행이 첫 번째 태스크를 통과하지 못했을 것입니다. –