GetDIBits The GetDIBits function retrieves the bits of the specified compatible bitmap and copies them into a buffer as a DIB using the specified format. int GetDIBits( HDC hdc, // handle to DC HBITMAP hbmp, // handle to bitmap UINT uStartScan, // first scan line to set UINT cScanLines, // number of scan lines to copy LPVOID lpvBits, // array for bitmap bits LPBITMAPINFO lpbi, // bitmap data buffer UINT uUsage // RGB or palette index );
hIcon类型可以使用GetIconInfo,获得一个ICONINFO结构,其中包含了一个位图句柄和他的掩图句柄,按照HBITMAP来处理就行了.
你这样做是不合理的.位图和图标的数据结构依赖硬件设置,在你电脑上显示很好的数据在别人电脑上就很糟糕.至少你应该把他们转化为dib数据.一般来讲,应该转化为jpeg或者gif数据来传输.
网上有很多dib的代码.windows有一个IPicture接口可以实现jpeg数据转化.你也可以使用gdi+来处理,更加方便
The GetDIBits function retrieves the bits of the specified compatible bitmap and copies them into a buffer as a DIB using the specified format. int GetDIBits(
HDC hdc, // handle to DC
HBITMAP hbmp, // handle to bitmap
UINT uStartScan, // first scan line to set
UINT cScanLines, // number of scan lines to copy
LPVOID lpvBits, // array for bitmap bits
LPBITMAPINFO lpbi, // bitmap data buffer
UINT uUsage // RGB or palette index
);