I'm trying to display an image from a stream data.
But there is no image when getting image::from stream.
It's my source code:
Code:
IStream* pstream = NULL;
if(SUCCEEDED(CreateStreamOnHGlobal(NULL, TRUE, &pstream)))
{ ULONG lreal = 0;
pstream->Write(chIncomingDataBuffer, iEnd, &lreal );
if(pstream!= NULL)
{ MessageBox(hWnd,
" Stream is OK",
"Connection strt",
MB_ICONINFORMATION|MB_OK); }
Image* image =Image::FromStream(pstream);
if(image)
{ RECT rect;
::GetWindowRect(hWnd, &rect);
Graphics graphics(hWnd);
graphics.DrawImage(image, 0, 0, rect.right-rect.left, rect.bottom-rect.top); } else
{ MessageBox(hWnd,
"No image is written",
"Connection strt",
MB_ICONINFORMATION|MB_OK); }
if(image)
delete image;
image = NULL;
if(pstream)
pstream->Release();
pstream = NULL; }
There is no image from data.