The Bitmap::FromHBITMAP method creates a Bitmap object based on a handle to a Windows Graphics Device Interface (GDI) bitmap and a handle to a GDI palette.
Bitmap * FromHBITMAP( IN HBITMAP hbm, IN HPALETTE hpal );
Handle to GDI bitmap.
Handle to a GDI palette used to define the bitmap colors if hbm is not a device-independent bitmap (DIB).
Type: Type: Bitmap*
This method returns a pointer to the new Bitmap object.
You are responsible for deleting the GDI bitmap and the GDI palette. However, you should not delete the GDI bitmap or the GDI palette until after the GDI+ Bitmap object is deleted or goes out of scope.
Do not pass to the Bitmap::FromHBITMAP method a GDI bitmap or a GDI palette that is currently (or was previously) selected into a device context.
This method does not preserve the alpha channel of the source GDI bitmap.
|Minimum supported client||Windows XP, Windows 2000 Professional [desktop apps only]|
|Minimum supported server||Windows 2000 Server [desktop apps only]|
|Header||gdiplusheaders.h (include Gdiplus.h)|