我正在尝试在 Windows CE6 下使用 CImage 加载 JPG 图像。我在网上搜索过,但大多数都使用如下所述的功能(但该功能本身对 CE 用户禁用):
CImage myImage;
myImage.Load(_T("C:\Image.jpg"));// Not available in windows CE
因为在atlimage.h:
#ifndef _WIN32_WCE
inline HRESULT CImage::Load( IStream* pStream ) throw()
{
if( !InitGDIPlus() )
{
return( E_FAIL );
}
Gdiplus::Bitmap bmSrc( pStream );
if( bmSrc.GetLastStatus() != Gdiplus::Ok )
{
return( E_FAIL );
}
return( CreateFromGdiplusBitmap( bmSrc ) );
}
inline HRESULT CImage::Load( LPCTSTR pszFileName ) throw()
{
if( !InitGDIPlus() )
{
return( E_FAIL );
}
Gdiplus::Bitmap bmSrc( (CT2W)pszFileName );
if( bmSrc.GetLastStatus() != Gdiplus::Ok )
{
return( E_FAIL );
}
return( CreateFromGdiplusBitmap( bmSrc ) );
}
是否有任何其他替代方法可以使用 CImage 或其他任何方式加载 jpg/bmp/gif/png 文件?