Sign in to follow this  

help drawing stream image

This topic is 3491 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i cannot seem to get the image to draw onto this window that i have created. i think it has to do with my HDC variable but im not sure
					if (pbyteImage != NULL)
					{
						EdsGetLength(stream, &size);
						HDC dc = GetDC(evfWin->GetHWND());
						CImage image;
						CComPtr<IStream> stream = NULL;
						HGLOBAL hMem = ::GlobalAlloc(GMEM_MOVEABLE | GMEM_ZEROINIT, size);
						LPVOID pBuff = ::GlobalLock(hMem);
						memcpy(pBuff, pbyteImage, size);
						::GlobalUnlock(hMem);
						CreateStreamOnHGlobal(hMem, TRUE, &stream);
						image.Load(stream);
						CRect rect;
						GetWindowRect(evfWin->GetHWND(), &rect);

						//draw
						SetStretchBltMode(dc, COLORONCOLOR);
						image.StretchBlt(dc, 0, 0, rect.Width(), rect.Height(), 0, 0, image.GetWidth(), image.GetHeight(), SRCCOPY);
						image.Destroy();
						::GlobalFree(hMem);
						ReleaseDC(evfWin->GetHWND(), dc);
					}

Share this post


Link to post
Share on other sites

This topic is 3491 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this