WinRT c++ は初めてです。C# から StorageFile 画像を渡してファイルを開き、それを WinRT の BitmapImage のソースとして設定して、画像の高さと幅を抽出しようとしています。次のコードを使用しています。
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 new BitmapImage(); の後 デバッガーは、ソース コードが見つからないと言って停止します。正しいコードを書くのを手伝ってもらえますか?