Loading bitmaps with createfile() +CreateDIBSection
Hi, I have been trying to learn windows graphics properly, so I can do more than just using brushes & stuff. The main thing I have been trying to do, is use CreateDIBSection, I think this isn't actually needed in loading bitmaps though and is just used to either create one from scratch, or get access to the bits in the bitmap. I may still want to use this function though as it could still be useful. What I mainly want to do (right now) though, is be able to load a bitmap with CreateFie(), and then, use the bitmap with bltbit etc. Also I need to be able to add other bitmaps to the same dc? I'm thinking of a gui, where if your mouse is over something it would highlight, -ie I woud "paste" another bitmap over that part.
This is the code I've got so far for CreateFile() and CreateDIBSection.
Thanks for any help, like I said, I did want to use DIBSection, but at the end of the day I just want to be able to load/paste bitmaps, not as resources though.
FileHandle = CreateFile(afilename,GENERIC_READ | GENERIC_WRITE,
FileMapping = CreateFileMapping(FileHandle,NULL,PAGE_READWRITE,
//MapViewOfFile returns a void pointer
FileHeader = (BITMAPFILEHEADER*)MapViewOfFile(FileMapping,
offset = FileHeader->bfOffBits;
// outfile <<FileHeader->bfOffBits;
HDC hdc = BeginPaint(hwnd, &ps);
GetObject(FileMapping, sizeof(bm), &bm);