Displaying Image from stream

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:
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;
	
	}



There is no image from data. Can anyone help me in this?
Thanks!
Topic archived. No new replies allowed.