Hi Philippe,
Here is an example for you :
include SaveClipBoard.inc
.data
IID_IPicture GUID <7BF80980h,0BF32h,101Ah,<8Bh,0BBh,00h,0AAh,00h,30h,0Ch,0ABh>>
message db 'SaveClipBoard.exe filename.bmp',0
.data?
buffer db 512 dup(?)
.code
start:
call main
invoke ExitProcess,0
main PROC uses esi
LOCAL hBmp :DWORD
LOCAL pBitmap :DWORD
LOCAL hGlobal :DWORD
LOCAL pcbSize :DWORD
LOCAL pStream :DWORD
LOCAL pd :PICTDESC
lea esi,buffer
invoke ParseCmdLine,esi
cmp eax,2
je @f
invoke StdOut,ADDR message
ret
@@:
invoke GetDesktopWindow
invoke OpenClipboard,eax
invoke GetClipboardData,CF_BITMAP
mov hBmp,eax
invoke CloseClipboard
mov pd.cbSizeofstruct,SIZEOF PICTDESC ; initialize the PICTDESC structure
mov pd.picType,PICTYPE_BITMAP
push hBmp
pop pd.bmp.hbitmap
invoke OleCreatePictureIndirect,ADDR pd,\
ADDR IID_IPicture,TRUE,ADDR pBitmap
; create the OLE image
invoke CreateStreamOnHGlobal,NULL,TRUE,ADDR pStream
; create the destination stream
; to save the icon
lea eax,pcbSize
coinvoke pBitmap,IPicture,SaveAsFile,pStream,\
TRUE,eax
invoke GetHGlobalFromStream,pStream,\
ADDR hGlobal
invoke GlobalLock,hGlobal ; get the address pointing
; the icon in memory
invoke WriteFileToDisc,DWORD PTR [esi+4],\
eax,pcbSize
; save the bitmap to disc
coinvoke pBitmap,IPicture,Release
coinvoke pStream,IStream,Release
ret
main ENDP
END start