how to create a bitmap dynamicly and save it to 256 color mode

As common , the bitmap is saved as 24bit or more,
But now , I have to create a bitmap like23
dynamicly, and save it as 256 color or 12bit , how can i do it using GDI or others.

thanks in advance.

[339 byte] By [danielqi] at [2007-12-16]