1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45
|
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;
}
|