void CBannerButton::DrawItem( LPDRAWITEMSTRUCT lpDrawItemStruct ) { if ( !m_pBanner ) return; CSingleLock MyLock( &m_BannerLock ); CDC* pDC = CDC::FromHandle(lpDrawItemStruct->hDC); CRect aRect; GetClientRect( aRect ); m_pBanner->Draw( pDC, aRect, DIB_DRAW_CENTER_HORZ | DIB_DRAW_SETPALETTE | DIB_DRAW_CENTER_HORZ | DIB_DRAW_CENTER_VERT | DIB_DRAW_STRETCH_EXPANDX | DIB_DRAW_STRETCH_REDUCEX | DIB_DRAW_STRETCH_EXPANDY | DIB_DRAW_STRETCH_REDUCEY | DIB_DRAW_KEEP_RATIO ); }
bool CBannerButton::LoadBanner( LPCSTR lpszImageFile ) { CSingleLock MyLock( &m_BannerLock ); ASSERT( !m_pBanner ); m_pBanner = new CImage; if ( !m_pBanner->LoadFile( lpszImageFile ) ) { delete m_pBanner; m_pBanner = NULL; return false; } Invalidate( ); return true; }
VOS_UINT32 CJanDBMain::AddRecd(CAdoRecordSet * pstuAdoRecd) { StuAdoRecd tItem; MyLock(); if (nRecdCount>0x8FFFFFFF) { nRecdCount = 0; } nRecdCount++; MyULock(); tItem.pstuAdoRecd = pstuAdoRecd; tItem.m_index = nRecdCount; if (ptRecdArray.Add(tItem)) { return -1; } return tItem.m_index; }
VOS_UINT32 CJanDBMain::AddConn(CAdoConnection *pstuAdoConn) { StuAdoConn tItem; MyLock(); if (nConnCount>0x8FFFFFFF) { nConnCount = 0; } nConnCount++; MyULock(); tItem.pstuAdoConn = pstuAdoConn; tItem.m_index = nConnCount; if (ptConnArray.Add(tItem) > 0) { return -1; } return tItem.m_index; }