15,979
社区成员
发帖
与我相关
我的任务
分享
#define SHEET_PREVIEW_WIDHT 266
#define SHEET_PREVIEW_HEIGHT 150
unsigned char g_sheet_bits[SHEET_PREVIEW_WIDHT * SHEET_PREVIEW_HEIGHT * 4] = ""; // 全局变量
...
CBitmap m_bitmap; // 类成员
BITMAP m_BMP;
...
m_BMP.bmBits = g_sheet_bits; // g_sheet_bits是有数据的的,已经赋值过了
m_BMP.bmType = 0;
m_BMP.bmWidth = rc.Width();
m_BMP.bmHeight = rc.Height();
/*m_BMP.bmBitsPixel = 32;
LONG bitsPerLine = m_BMP.bmWidth * m_BMP.bmBitsPixel;
m_BMP.bmWidthBytes = ((bitsPerLine+15)/16)*2;*/
m_bitmap.CreateBitmapIndirect(&m_BMP); // 执行失败,返回值为0
TRACE("--------- %d \n", GetLastError()); // error code 87,参数不正确,把上面注释掉的设置上也还是不行。