Help with slow GDI code?

Can anyone tell me why this wouldn’t create a bitmap in video memory?

hdc = GetDC(hwnd);
hbm = CreateCompatibleBitmap(hdc, window->w, window->h);

The behavior I’m seeing is that manually clearing a DIB and using BitBlt()
to copy it to a window is actually slightly faster than creating a bitmap
as above, using a brush to clear it, and then copying the bitmap to the
window using BitBlt().

-Sam Lantinga, Senior Software Engineer, Blizzard Entertainment