I have a problem to SelectObject of Bitmap into memery DC. My code is like,
Code:
HINSTANCE hinstOriginal;
hinstOriginal = ::AfxGetResourceHandle();
::AfxSetResourceHandle(g_hResInstance);

CDC mem;
CBitmap *oldBmp;
CBitmap temp;
BOOL B = temp.LoadBitmap(id);   //id is resource id 
BITMAP BitMap;
temp.GetBitmap(&BitMap);

mem.CreateCompatibleDC( pPrintDC );             // a printer DC
mem.SetMapMode (pPrintDC->GetMapMode ());

oldBmp = mem.SelectObject(&temp);       // this call returns 0 on some PCs! 

CPoint size;
size.x = BitMap.bmWidth;
size.y = BitMap.bmHeight;
mem.DPtoLP(&size);

BOOL bret = pGDoc->m_pDC->StretchBlt(m_iX,
                m_iY*-1,
                m_iWidth,
                m_iHeight*-1, 
                &mem,
                0,
                0,
                size.x,
                size.y,
                SRCCOPY);
This code works on same PC, but not on others, SelectObject returns 0;
Please help.

Thank you very much.

hlin_do

henryzlin@hotmail.com

Last edited by shabbir; 10Feb2007 at 09:40.. Reason: Code formating.