Well, if you want to create a buffer, you're best to just create an offscreen device context. You can access it the exact same way you do the window's client area during painting, using BitBlt and any other command that works with DCs. You then create a bitmap the size of the screen, giving you a usable area to draw to (you can then blit the entire DC to the screen, effectively accomplishing double buffering)
It's a lot easier than drawing to DIBs for a buffer (actually, the only time it really makes sense to use DIBs is if you're loading data from a file)
HDC hdc;
HBITMAP hbmp, hbmpOld;
// Create a device context compatible with the screen
hdc = CreateCompatibleDC(NULL);
if (hdc)
{
// Create a bitmap the size of the screen, and select it into the DC (assuming 1024x768 here, change values to suit)
hbmp = CreateCompatibleBitmap(hdc, 1024, 768);
if (hbmp)
{
hbmpOld = SelectObject(hdc, hbmp);
// you can now use this memory DC as long as you want. it persists until you destroy it
} else
DeleteDC(hdc);
}
// use it here...
BitBlt(hdc, ....);
// clean-up
// select the old bitmap back in
SelectObject(hdc, hbmpOld);
// delete the screen size bitmap that was created
DeleteObject(hbmp);
// delete the offscreen DC
DeleteDC(hdc);
And there you have it. A *lot* easier than using DIBs.
Btw, you can select a DIB into a device context just as easily as a standard bitmap. That way, you can easily call BitBlt to draw it elsewhere (in this case, you can save the CreateCompatibleBitmap step because the bitmap is coming from the DIB section you already have set up, and just go straight away and select it into the device context).
-- A little note about Device Contexts, if you're not familiar. A device context in windows is basically a virtual representation of a device and all the modes it has set. A screen has a device context assigned to it, as do other bitmap-output devices (printers, etc). The client area of a window also can have a DC assigned to it (which is usually accessed via BeginPaint / EndPaint calls or GetDC / ReleaseDC calls).
A DC has objects 'selected' into it, such as bitmaps, pens, brushes, etc. All the primitives drawing functions in win32 deal with DC's. (BitBlt, LineTo, Polyline, Circle, TextOut, DrawText, ... so on).
It is possible to obtain the Device Context for the entire screen (usually it's only used to get the physical characteristics of the screen, I've never heard about drawing on it directly. If you need to draw directly to the entire screen surface, it's probably best to use DirectX or OpenGL).