同样的代码实例vc6.0编译的正常运行,在vs2010及以上版本新建的项目中编译的不能运行。当调用okConvertRect时总是返回0,
表示转化错误。没有说明原因。经过多方实验只要将编译环境设置一下就可.
1 :项目属性中 c++-->代码生成 -->结构成员对其-->1个字节或者2字节.
2: 或者局部块级结构体对齐,
#pragma pack (push,2)
typedef struct _blockinfo {
SHORT iType; //=BK or SQ, BM
//struct _blocksize;
SHORT iWidth; //width *
SHORT iHeight; //height *
SHORT iBitCount; //pixel bytes iBitCount *
SHORT iFormType; //rgb format type, need to fill when RGB565 or RGB 555
union {
struct {
SHORT lBlockStep; //block stride (step to next image header)
SHORT iHiStep;// HIWORD of block stride
};
DWORD dwBlockStep;
};
union {
struct {
SHORT lTotal; //frame num
SHORT iHiTotal;// HIWORD of total
};
DWORD dwTotal;
};
SHORT iInterval; //frame interval
LPBYTE lpBits;// image data pointer / file path name
LPBYTE lpExtra;// extra data (like as palette, mask) pointer
} BLOCKINFO, *LPBLOCKINFO;
#pragma pack(pop)
保存设置重新编译即可。
ok实例项目vs2010下报错的解决办法
最新推荐文章于 2020-12-04 17:25:32 发布