Check if Gdiplus::Bitmap::FromFile has returned a valid Bitmap

c++, gdi+

Solution

It turns out that `Bitmap::GetLastStatus()` is what I was looking for, it returns `Gdiplus::Ok` if the load operation succeded, or an error code if it failed.

Problem

I had assumed that Gdiplus::Bitmap::FromFile returns NULL if the file is not a valid image, but it returns a non-NULL even if I pass it a doc file, for example. There doesn't seem to be an IsValid method for Bitmap, or anything similar. So how do I know if Gdiplus::Bitmap::FromFile has really loaded a valid image?

Original source