WinRT C++을 처음 사용합니다. C#에서 StorageFile 이미지를 전달하고 파일을 열고 WinRT의 BitmapImage 소스로 설정하여 이미지의 높이와 너비를 추출하려고합니다. 다음 코드를 사용하고 있습니다.BitmapImage SetSourceAsync in WinRT C++
auto openOperation = StorageImageFile->OpenAsync(FileAccessMode::Read); // from http://msdn.microsoft.com/en-us/library/windows/desktop/hh780393%28v=vs.85%29.aspx
openOperation->Completed = ref new
AsyncOperationCompletedHandler<IRandomAccessStream^>(
[=](IAsyncOperation<IRandomAccessStream^> ^operation, AsyncStatus status)
{
auto Imagestream = operation->GetResults();
BitmapImage^ bmp = ref new BitmapImage();
auto bmpOp = bmp->SetSourceAsync(Imagestream);
bmpOp->Completed = ref new
AsyncActionCompletedHandler (
[=](IAsyncAction^ action, AsyncStatus status)
{
action->GetResults();
UINT32 imageWidth = (UINT32)bmp->PixelWidth;
UINT32 imageHeight = (UINT32)bmp->PixelHeight;
});
});
이 코드는 작동하지 않는 것 같습니다. BitmapImage^bmp = ref 새로운 BitmapImage(); 라인 이후 디버거는 소스 코드가 없다는 말을 멈 춥니 다. 올바른 코드를 작성할 수 있습니까?
을 :
는 나는 다음과 같이 대략 모양한다고 생각합니다 > 완료'**'+ ='**'ref new ... ' –