15 мая 2023 года "Исходники.РУ" отмечают своё 23-летие!
Поздравляем всех причастных и неравнодушных с этим событием!
И огромное спасибо всем, кто был и остаётся с нами все эти годы!

Главная Форум Журнал Wiki DRKB Discuz!ML Помощь проекту


CStatic::SetBitmap on NT vs. W95

Steve Mark -- steve@otms.com
Wednesday, October 23, 1996

Environment: WinNT 4 SP1, VC++ 4.2b, Win95

I can display a bitmap using CStatic::SetBitmap in WinNT, but not in Win95.
 Application is MFC DLL-based.  Bitmaps are shown elsewhere just fine.

Does anyone know why this won't show up in Win95 and how to fix it?

Thanks in advance!

Steve

_________________________________________________________________
Steven Mark                           E-mail: steve@otms.com
On-The-Mark Systems                   Tel:    510.648.9514
3494 Camino Tassajara Rd., Suite 239  Fax:    510.648.9507
Danville, CA 94506                    Web:    http://www.otms.com

     Custom Software Analysis, Design, and Implementation



Lior Messinger -- 100274.2607@compuserve.com
Sunday, October 27, 1996

Steve,

I don't know the reason, but I had problems myself with SetBitmap, although mine was the opposite: it didn't work in NT.

Anyway, here's the code I used instead (to display a bmp of a dog IDB_GREYDOG1:

	// set bitmap
    CBitmap * pBmpOld;
    RECT rectStaticClient;
    // Load bitmap resource - remember to call DeleteObject when done.
    VERIFY( m_clsDogBmp.LoadBitmap( IDB_GREYDOG1 ) );
    // Get bitmap information    
    m_clsDogBmp.GetObject( sizeof(BITMAP), &m_bmInfo );
    m_stcDog.GetClientRect( &rectStaticClient );
    m_BmpSize.cx = rectStaticClient.right;    // zero based
    m_BmpSize.cy = rectStaticClient.bottom;    // zero based
    // Convert to screen coordinates using static as base,
    // then to DIALOG (instead of static) client coords 
    // using dialog as base
    m_stcDog.ClientToScreen( &rectStaticClient );
    ScreenToClient( &rectStaticClient );
    m_BmpPt.x = rectStaticClient.left;
    m_BmpPt.y = rectStaticClient.top;
    
    // Get temporary DC for dialog - Will be released in dc destructor
    CClientDC dc(this);
    // Create compatible memory DC using the dialogs DC
    VERIFY( m_dcMemDog1.CreateCompatibleDC( &dc ) );
    // Select bitmap into DC.  
    // Get pointer to original bitmap
    // NOTE! This is temporary - save the handle instead
    VERIFY( pBmpOld = m_dcMemDog1.SelectObject( &m_clsDogBmp ) );
    VERIFY( m_hBmpOld1 = (HBITMAP) pBmpOld->GetSafeHandle() );

    // StretchBlt Dog    bitmap onto static's client area
    clsDc.StretchBlt( m_BmpPt.x, m_BmpPt.y, m_BmpSize.cx, m_BmpSize.cy, 
                   &m_dcMemDog1, 0, 0, m_bmInfo.bmWidth-1, m_bmInfo.bmHeight-1,
                   SRCCOPY );


regards,
Lior.



Environment: WinNT 4 SP1, VC++ 4.2b, Win95

I can display a bitmap using CStatic::SetBitmap in WinNT, but not in Win95.
 Application is MFC DLL-based.  Bitmaps are shown elsewhere just fine.

Does anyone know why this won't show up in Win95 and how to fix it?

Thanks in advance!

Steve

_________________________________________________________________
Steven Mark                           E-mail: steve@otms.com
On-The-Mark Systems                   Tel:    510.648.9514
3494 Camino Tassajara Rd., Suite 239  Fax:    510.648.9507
Danville, CA 94506                    Web:    http://www.otms.com

     Custom Software Analysis, Design, and Implementation





| Вернуться в корень Архива |