Advertisement Jump to content


This topic is now archived and is closed to further replies.


Windows Surface...

This topic is 7017 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

CreateCompatibleBitmap is old! Try CreateDIBSection. To create...

ZeroMemory(&bmi, sizeof(bmi));
bmi.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
bmi.bmiHeader.biWidth = 1200;
bmi.bmiHeader.biHeight = 900;
bmi.bmiHeader.biBitCount = 32;
bmi.bmiHeader.biPlanes = 1;
HBITMAP hbm = CreateDIBSection(0, &bmi, DIB_RGB_COLORS, NULL, 0, 0);

... or something. To blit into it...

HDC hdc = CreateCompatibleDC(0);
SelectObject(hdc, hbm);
BitBlt(hdc, ... whatever ..., SRCCOPY);

.. to blit it into your window...

HDC hdc = CreateCompatibleDC(0);
SelectObject(hdc, hbm);
BitBlt(hdcWindow, 0, 0, 1200, 900, hdc, 0, 0, SRCCOPY);

Share this post

Link to post
Share on other sites
I'm trying to write a map maker for a 2d rpg game.... but i'm stuck because when i use the CreateCompatibleBitmap() or whatever its called to create a surface, i don't know how to blit 50x50 bitmaps on to it then back on the screen. i've tried:

hdcMem = GetDC (hWnd) ;
hBitmap = CreateCompatibleBitmap(hdcMem, 1200, 900) ;
ReleaseDC ( hWnd, hdcMem ) ;

this i'm told creates the surface, but i'm don't know where to go from there. Any help would be very much appreciated.



Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!