You''re the man ~~~!! :D
I change the code with:
image->width = InfoHeader.biWidth;
image->height = InfoHeader.biHeight;
image->bpp = InfoHeader.biBitCount;
ImageSize = image->width * image->height * image->bpp;
image->data = new unsigned char [ImageSize];
// using ImageSize=image->width*image->height*3 not necessarily safe, still got crashed in some bitmaps.
Now loading any bitmaps would not crash my program, though,
while loading "BG.bmp" in lesson24.zip, still it would load in a bag image (but would not crash).
I think the code may not be 100% perfect though, I''ll keep testing loading other bitmaps.
I think I''d send ShiningKnight an email to report this.
Thanks a lot lot lot!