Advertisement

"Torn" images with BitBlt

Started by October 03, 2000 01:27 PM
11 comments, last by Orpheum 24 years, 3 months ago
Well I've looked though my win32 books and I'm afraid I can't help you that much. I was thinking though, I had a similar problem to yours (I'm using directx though, where I was loading bitmaps using gdi).

The process I think may help you is:

        HBITMAP hBitmap = (HBITMAP)LoadImage(NULL, FileName , IMAGE_BITMAP, 0, 0,LR_LOADFROMFILE | LR_CREATEDIBSECTION);	//not sure on some of the flagsHDC BitmapDC = CreateCompatibleDC (NULL); SelectObject(BitmapDC, hBitmap); HDC WindowDC = GetDC (HWND hWindow);BitBlt(WindowDC, x, y, width, height, BitmapDC, 0, 0, SRCCOPY);ReleaseDC(WindowDC);    


NOTE:
I haven't tested this in any way/shape/form, it's based upon some code I wrote to load bitmaps to a directdraw surface, so no guarantees.

I felt bad 'coz hardly anyone seemed to have helped you on this, and I hope this helps.

- Jamie

[edit] fixed up dodgy source formatting
Waassaap!!

Edited by - mr_jrt on October 6, 2000 4:05:33 PM
Waassaap!!
Well I finally fixed this bitch - but the fix is unacceptable. This post is so damn unpopular that I will start a new thread for the discussion of another work around... Thanks to all those who contributed to this tho!!
There is no spoon.
Advertisement
You must use invalidaterect, to make the window repaint.

Put invalidate rect in your message loop.

So many ways of doing it....


While
{
if(Peekmessage)
{
}
invalidterect
}
Hardcore Until The End.

This topic is closed to new replies.

Advertisement