VS2005中的 error C2065: FILE : undeclared identifier:
bool CGDISurface::LoadBmp( CGDIGraphicsDevice *pDevice, const char *szFileName )
{
// 读取位图文件信息,确定位图大小
FILE *fp = fopen( szFileName, "rb" );
if( NULL == fp )
{
OutputDebugString( L"Open bmp file [%s] failed(%s:%d)");
return false;
}
BITMAPFILEHEADER bmfh;
BITMAPINFOHEADER bmih;
fread( &bmfh, sizeof(BITMAPFILEHEADER), 1, fp );
fread( &bmih, sizeof(BITMAPINFOHEADER), 1, fp );
fclose(fp);
// 如果不是位图则返回失败
if( bmfh.bfType != 0x4D42 )
{
OutputDebugString( L"the bmp file [%s] type is failed(%s:%d)");
return false;
}
HBITMAP hBmp = (HBITMAP)::LoadImage(NULL, szFileName, IMAGE_BITMAP, bmih.biWidth, bmih.biHeight, LR_LOADFROMFILE | LR_CREATEDIBSECTION );
m_iWidth = bmih.biWidth;
m_iHeight = bmih.biHeight;
HWND hWnd = pDevice->GetWnd();
HDC hdcWindow = ::GetDC( hWnd );
m_hBitmap = ::CreateCompatibleBitmap( hdcWindow, m_iWidth, m_iHeight );