+// wrapper around ::GetObject() for DIB sections
+static inline bool GetDIBSection(HBITMAP hbmp, DIBSECTION *ds)
+{
+ // note that at least under Win9x (this doesn't seem to happen under Win2K
+ // but this doesn't mean anything, of course), GetObject() may return
+ // sizeof(DIBSECTION) for a bitmap which is *not* a DIB section and the way
+ // to check for it is by looking at the bits pointer
+ return ::GetObject(hbmp, sizeof(DIBSECTION), ds) == sizeof(DIBSECTION) &&
+ ds->dsBm.bmBits;
+}
+