CBitmap::CreateCompatibleBitmap调用返回错误码0失败的原因?
CreateCompatibleBitmap调用失败且GetLastError返回0的问题
在为打印流程创建内存位图时,CreateCompatibleBitmap调用失败,但调用GetLastError()返回错误码0,原因无法确定。相关失败代码片段如下:
if (!m_pImageMemBitmap->CreateCompatibleBitmap(pDC, m_nMemDCWidth, m_nMemDCHeight)) { DWORD dwError = ::GetLastError(); CString errorMessage; errorMessage.Format(_T("CreateCompatibleBitmap failed with error code %lu\n"), dwError); TRACE(errorMessage); }
已知信息:
- 尽管未在官方文档中明确说明,但
CBitmap存在4GB的大小上限,当前位图参数(宽度76500、高度6600、颜色深度8位)计算出的总大小远低于该限制 - 调用失败具有间歇性,通过Process Explorer工具未检测到进程存在明显的资源短缺或资源泄漏情况
内容的提问来源于stack exchange,提问作者Dave Colter
相关产品推荐
相关产品推荐

