happytc 发表于 2011-4-9 08:27:07

怎么访问这样格式的二进制的图标文件?

au3怎么访问这样格式的文件,如附件的文件,它是很多图标集成的文件,格式说明如下:
怎么读出它后,用函数GUICtrlSetImage()生成它?

附件文件(Tool.br2)格式:
---------------------------------------------------------------------------------------------------------------------------------------------------
The format is as follows:
- 4 byte checksum (to check whether it's still in sync with .bar file)
- 4 byte size of next block - if 0, it's an empty icon. Each icon starts with this size field
- 1 byte: if 0, there follows a monochrome+color bitmap, otherwise just one monochrome for black+white icons (double hight)
- sizeof(BITMAPINFOHEADER): BITMAPINFOHEADER structure for the black+white mask, +2 bytes palette
- the actual image data of the mask
- the mask data. bwimagesize:=((headermask.bmWidth+31) and not 31) div 8*headermask.bmheight;
- if not monochrome:
- sizeof(BITMAPINFOHEADER): BITMAPINFOHEADER structure for color image
- the palette (if required according to the header) and bitmap bits follow.
If biBitCount=32, TC uses CreateDIBSection followed by a byte copy to the buffer returned by CreateDIBSection to create the bitmap.
If biBitCount=1, TC uses CreateBitmap followed by SetDIBits.
Otherwise, TC uses CreateCompatibleBitmap followed again by SetDIBits to create the bitmap.
Finally, use CreateIconIndirect to create the icon, and DeleteObject to delete color and mask bitmaps.

Here is the calculation of the palette size and image data size:

ClrBits:=pbih.biPlanes * pbih.biBitCount;
if ClrBits=1 then ClrBits:=1
else if ClrBits<=4 then ClrBits:=4
else if ClrBits<=8 then ClrBits:=8
else if ClrBits<=16 then ClrBits:=16
else if ClrBits<=24 then ClrBits:=24
else ClrBits:=32;
if ClrBits<=8 then palettesize:=1 shl ClrBits
else palettesize:=0;
trueimagesize:=((pbih.biWidth * ClrBits +31) and not 31) div 8*pbih.biHeight;
--------------------------------------------------------------------------------------------------------

happytc 发表于 2011-4-9 08:29:57

或者au3怎么生成这样的二进制图标文件集?一个个读不同程序(文件)的图标太慢了,先生成一个二进制的,速度会大大提高!

netegg 发表于 2011-4-9 09:06:00

去看看_winapi_createiconfromH什么玩意

haijie1223 发表于 2011-4-9 12:54:11

不会 帮顶共同学习

kadingxiaodi 发表于 2011-4-9 14:28:48

不太明白,顶一下,试验一下
页: [1]
查看完整版本: 怎么访问这样格式的二进制的图标文件?