How to create bitmap in message body?

I am using C API for handling on send event. I try to relapse image of new attachment.So I have HBITMAP, I can get from it BYTE data. Can some body post code or some explanation of doings for adding CDGRAPHIC itno message body.

I know that I must add

CDGRAPHIC

CDBITMAPHEADER

CDBITMAPSEGMENT

is in CDBITMAPSEGMENT not binary data of .bmp file? they base64 coded?

then some like CDCOLORTABLE and CDPATTERNTABLE.

I try to format it and wtrite into body buffer but something wrong. Is there exist some way converting BMP into Lotus BMP format using Lotus functionality?

Can anybody help me.

You`ll save me. Thank You.