类型强转问题
inline HDC CImage::CDCCache::GetDC() throw()
{
HDC hDC;
for( int iDC = 0; iDC < CIMAGE_DC_CACHE_SIZE; iDC++ )
{
hDC = static_cast< HDC >( InterlockedExchangePointer( reinterpret_cast< void** >(&m_ahDCs[iDC]), NULL ) );
if( hDC != NULL )
{
return( hDC );
}
}
hDC = ::CreateCompatibleDC( NULL );
return( hDC );
}
inline void CImage::CDCCache::ReleaseDC( HDC hDC ) throw()
{
for( int iDC = 0; iDC < CIMAGE_DC_CACHE_SIZE; iDC++ )
{
HDC hOldDC;
hOldDC = static_cast< HDC >(InterlockedExchangePointer( reinterpret_cast< void** >(&m_ahDCs[iDC]), hDC ) );
if( hOldDC == NULL )
{
return;
}
else
{
hDC = hOldDC;
}
}
if( hDC != NULL )
{
::DeleteDC( hDC );
}
}
在上面程序中出现atlimage.h(443) : error C2440: 'static_cast' : cannot convert from 'long' to 'struct HDC__ *'
问题,不知道怎么修改 ,才能使类型转换的过来