I'm writing a program that will display bitmaps in its view. It is a view without a document. When the CBitmap does the LoadBitmap(nID) function, the CGDIObject does not initialize the CBitmap object and obtain the m_hObject value - it remains NULL. I have used the exact same code elsewhere, and it works fine, can anyone tell me how it may work in one place, and not another?

Here is some of the code:

Code:
in CChildView.h file derived from CView
    CBitmap
      m_bmpServer_0,
      m_bmpServer_1,
      m_bmpServer_2,
      m_bmpServer_3,
      m_bmpServer_4,
      m_bmpServer_5;
==================================================


in CChildView.cpp file in init() function
// fails to initialize, CGDIObject m_hObject = NULL
    m_bmpServer_0.LoadBitmap( IDB_SERVER0 );
    m_bmpServer_1.LoadBitmap( IDB_SERVER1 );
    m_bmpServer_2.LoadBitmap( IDB_SERVER2 );
    m_bmpServer_3.LoadBitmap( IDB_SERVER3 );
    m_bmpServer_4.LoadBitmap( IDB_SERVER4 );
    m_bmpServer_5.LoadBitmap( IDB_SERVER5 );
==================================================
	
in CChildView.cpp file in OnDraw(CDC* pDC) function
	CBitmap *
      pBitmap[] =
      {
          &m_bmpServer_0,
          &m_bmpServer_1,
          &m_bmpServer_2,
          &m_bmpServer_3,
          &m_bmpServer_4,
          &m_bmpServer_5,
      };
	BITMAP
      bm;
    CDC
      dcMem;
    int
      i,
      nOffSet,
      nYpos;

    dcMem.CreateCompatibleDC(pDC);

    for ( i = 1; i < 7; i++ )
    {
      nOffSet = (i - 1) * 115;
      pBitmap[i]->GetObject( sizeof(BITMAP), &bm );
      dcMem.SelectObject(pBitmap[i]);
      nYpos = 76 + nOffSet;
      pDC->BitBlt( 10, nYpos, bm.bmWidth, bm.bmHeight, &dcMem, 0, 0, SRCCOPY );
    }

    dcMem.DeleteDC();