This question has two parts, thus the big point value.
Dan Rollins posted an excellent answer here: (see accepted answer)
My question seeks two things:
1. Dan's GetImgSubset() method needs to work as it does, only with 8bit grayscale images
2. My app needs the ability to create very large bitmaps (single files that are composites of 1000x1000 8bit frames. The largest we need to support is 40 frames by 40 frames, which is a single 160MB image.) For the smaller composites (generally up to around 10 frames by 10 frames) I am able to create a DIB section and blit my frames into the appropriate rectangle within it, and then save it out. But once I need the size to be more than around 10x10, my attempt at creating the DIB section results in a NULL. Not to mention when it does work, having such a large HBITMAP in memory creates a performance hit.
So I would like to be able to create a file on the drive first, and then essentially use a reverse of Dan's function, something along the lines of "SetImgSubset" that would take an HBITMAP and a rect, and write into the file, the bitmap data, at the specified location. Filemapping is still something I lack good understanding of. :(
The accepted answer could be modificiations of Dan's code, or something all together new.