GLubyte pointer_to_your_array[256*256*3];
// 1. prepare BITMAPINFOHEADER for GetDIBits
BITMAPINFOHEADER info;
info.biSize=sizeof(BITMAPINFOHEADER);
info.biWidth=256;
info.biHeight=-256; // we usually want a top-down-bitmap
info.biPlanes=1;
info.biBitCount=24;
info.biCompression=BI_RGB;
info.biSizeImage=0;
info.biXPelsPerMeter=10000; // just some value
info.biYPelsPerMeter=10000; // just some value
info.biClrUsed=0;
info.biClrImportant=0;
// 2. let's do it
GetDIBits(hdc,
hbitmap,
0,
256,
(void*)pointer_to_your_array,
(BITMAPINFO*)&info,
DIB_RGB_COLORS);
// 3. Now your array should contain the raw bitmap data