Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HBITMAP issue.

Status
Not open for further replies.

seanw001

Programmer
Sep 5, 2007
1
US
Im writing an sprite class and I have ran into a problem.

Code:
CopiedSprite.sImage->SpritePos.x = (SelectedSprite.sImage->SpritePos.x + 20);
CopiedSprite.sImage->SpritePos.y = (SelectedSprite.sImage->SpritePos.y + 20); 
[COLOR=red]*CopiedSprite.sImage->hBitmap = *SelectedSprite.sImage->hBitmap; [/color]
::GetObject(CopiedSprite.sImage->hBitmap, sizeof (BITMAP), &CopiedSprite.sImage->Bitmap);
CopiedSprite.sImage->hBitmap = SelectedSprite.sImage->hBitmap;
mImageRepository.push_back(CopiedSprite.sImage);

In the red bold is my problem. I need to copy the bitmap that HBITMAP points to to another HBITMAP. I tried to simply dereference both hBitmaps so that it would copy the bitmap, and it compiles, but I get a runtime issue that just kicks me out when it reaches that line.

Does the winAPI have a function or something for copying a bitmap that an hbitmap points to into another hbitmap?

Thanks
 
Try looking up bitblt (bit blast). I'm assuming that you have creted a device compatible bitmap and pointed the CopiedSprit.sImage->hBitmap to it.
 
Just so you know: the 'blt' in 'bitblt' is for 'blit' not 'blast' (and was originally short for Block Transfer)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top