SaveBmpFromHBitmap function creating and saving a bitmap represented by the handle. The example code below loads a bitmap and recreates it with SaveBmpFromHBitmap.
.386
.model flat,stdcall
option casemap:none
include Example.inc
includelib kernel32.lib
includelib user32.lib
includelib gdi32.lib
SaveBmpFromHBitmap PROTO :DWORD,:DWORD
.data
BmpFile db 'Sample.bmp',0
filename db 'TestBitmap.bmp',0
.data?
hBitmap dd ?
.code
start:
xor eax,eax
invoke LoadImage,eax,ADDR BmpFile,\
IMAGE_BITMAP,eax,eax,LR_LOADFROMFILE
test eax,eax
jz @f
mov hBitmap,eax
invoke SaveBmpFromHBitmap,eax,ADDR filename
@@:
invoke DeleteObject,hBitmap
invoke ExitProcess,0
END start