Click here to Skip to main content
16,016,736 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
Questioncapturing notify messages Pin
kitkat120127-May-09 6:00
kitkat120127-May-09 6:00 
AnswerRe: capturing notify messages Pin
led mike7-May-09 7:02
led mike7-May-09 7:02 
QuestionConfusion about object code generated? Pin
lionelcyril7-May-09 5:12
lionelcyril7-May-09 5:12 
AnswerRe: Confusion about object code generated? Pin
Eytukan7-May-09 5:20
Eytukan7-May-09 5:20 
AnswerRe: Confusion about object code generated? Pin
«_Superman_»7-May-09 5:22
professional«_Superman_»7-May-09 5:22 
GeneralRe: Confusion about object code generated? Pin
Eytukan7-May-09 5:25
Eytukan7-May-09 5:25 
AnswerRe: Confusion about object code generated? Pin
CPallini7-May-09 7:00
mveCPallini7-May-09 7:00 
QuestionIWinHttpRequest get_ResponseStream and Bitmap FromStream [modified] Pin
J.B.7-May-09 4:54
J.B.7-May-09 4:54 
Hi,

I am writing some code that can download JPEG images from the net (HTTP) and display them on my dialog app.

So far I am able to get the image with IStream interface by using IWinHttpRequest's get_ResponseStream(). But I found myself failing to take the Stream object to load it to GDI+ Bitmap object.
IStream *pStream; // valid Stream object downloaded
if (NULL != pStream)
{
	Bitmap *pGdiBmp = NULL;

	// Rewind IStream.
	LARGE_INTEGER llMove;
	llMove.LowPart = 0;
	llMove.HighPart = 0;
	pStream->Seek(llMove, STREAM_SEEK_SET, NULL);
	pGdiBmp = Bitmap::FromStream(pStream);
}

pGdiBmp is always NULL. I tried to save pStream to disk and the resulted binary is correct JPEG file.

What am I doing wrong here?

Any help would be great.
Thanks in advance.

modified on Thursday, May 7, 2009 11:48 AM

AnswerRe: IWinHttpRequest get_ResponseStream and Bitmap FromStream Pin
Stuart Dootson7-May-09 7:28
professionalStuart Dootson7-May-09 7:28 
AnswerRe: IWinHttpRequest get_ResponseStream and Bitmap FromStream Pin
J.B.7-May-09 20:58
J.B.7-May-09 20:58 
GeneralRe: IWinHttpRequest get_ResponseStream and Bitmap FromStream Pin
Stuart Dootson7-May-09 21:47
professionalStuart Dootson7-May-09 21:47 
GeneralRe: IWinHttpRequest get_ResponseStream and Bitmap FromStream Pin
J.B.7-May-09 22:50
J.B.7-May-09 22:50 
GeneralRe: IWinHttpRequest get_ResponseStream and Bitmap FromStream Pin
Stuart Dootson7-May-09 23:04
professionalStuart Dootson7-May-09 23:04 
Questionit`s so hard, pro please help me Pin
trongduy7-May-09 4:20
trongduy7-May-09 4:20 
AnswerRe: it`s so hard, pro please help me Pin
David Crow7-May-09 4:23
David Crow7-May-09 4:23 
Questionstopping an exe Pin
jimjim7337-May-09 4:20
jimjim7337-May-09 4:20 
AnswerRe: stopping an exe Pin
David Crow7-May-09 4:24
David Crow7-May-09 4:24 
GeneralRe: stopping an exe Pin
I am BATMAN7-May-09 7:10
I am BATMAN7-May-09 7:10 
GeneralRe: stopping an exe Pin
David Crow7-May-09 7:33
David Crow7-May-09 7:33 
JokeRe: stopping an exe Pin
CPallini7-May-09 9:40
mveCPallini7-May-09 9:40 
AnswerRe: stopping an exe Pin
Stuart Dootson7-May-09 4:26
professionalStuart Dootson7-May-09 4:26 
QuestionSending data from vector into and array Pin
brucewayn7-May-09 2:59
brucewayn7-May-09 2:59 
AnswerRe: Sending data from vector into and array Pin
Rajesh R Subramanian7-May-09 3:21
professionalRajesh R Subramanian7-May-09 3:21 
AnswerRe: Sending data from vector into and array Pin
led mike7-May-09 4:17
led mike7-May-09 4:17 
AnswerRe: Sending data from vector into and array Pin
Stuart Dootson7-May-09 4:23
professionalStuart Dootson7-May-09 4:23 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.