Fast graphics under Windows
Lots of books have been written on this subject. The bottom line for 2D graphics is to use CreateDIBSection() (consult your handy dandy Windows development environment documentation) and friends for windowed or otherwise very system-friendly fast graphics, and DirectDraw for fast full screen graphics where you get to dictate the color mode (8-bit, 16-bit, 32-bit, etc.).
The trick to CreateDIBSection() is that to actually get your bitmap to the screen, you have to jump through a few hoops. First you have to use CreateCompatibleDC() to create a Device Context to blit from (think of it as just a hunk of program that knows how to move pixels), SelectObject() your HBITMAP into it, then obtain the DC for your destination window, and use BitBlt() to blit from the created DC to the window's DC.
DirectDraw is pretty straight forward if all you want is a linear full screen framebuffer to manually throw pixels at (that's all I usually use, for compatability with as much hardware as possible). First buy a good book on DirectDraw. Then create a DirectDraw object, switch to Exclusive mode, change the screen mode to whatever you like, acquire the DDSurface object for the Primary surface, create an Off-Screen System Memory surface of the same size and bit depth to be your Back Buffer, then every frame Lock the Back Buffer surface, compose your graphics there in system memory, Unlock the surface, and do a DirectDraw Blit from the off-screen surface to the Primary surface. This works for a lot of things, and gives you the advantage of being able to quickly read pixels back from your back buffer (to do alpha-blending, additive-blending, burn effects, etc.), as reading pixels from a Video Memory surface is SLOW, and dangerous. To get more speed in certian styles of games, you can use Dirty Rectangle updating to only blit the changed parts of the back buffer to the visible primary surface (DX-Ball 2 uses this technique).
Check out the BackBuffer Page for some free source code that handles DirectDraw, CreateDIBSection, and even OpenGL windows!
Copyright 1998-1999 by Seumas McNally.
Courtesy Of Longbow Digital Artists