This is a function right out of the source code on the cd that came with "Isometric Programming with DirectX 7". It crashes with an exception error at the GetDC(). I don't know exactly what could be wrong, especially with the fact that this is totally uncharted territory for me. I tried using memset() on the hdc, but that wasn't the problem. Any help would be appreciated.
Code:
LPDIRECTDRAWSURFACE7 LPDDS_LoadFromFile(LPDIRECTDRAW7 lpdd,LPCTSTR lpszFileName)
{
//load the bitmap
CGDICanvas gdic;
gdic.Load(NULL,lpszFileName);
//create offscreen surface with same width and height
LPDIRECTDRAWSURFACE7 lpdds=LPDDS_CreateOffscreen(lpdd,gdic.GetWidth(),gdic.GetHeight());
//retrieve hdc for surface
HDC hdcSurf;
lpdds->GetDC(&hdcSurf);
//blit image onto surface
BitBlt(hdcSurf,0,0,gdic.GetWidth(),gdic.GetHeight(),gdic,0,0,SRCCOPY);
//release dc
lpdds->ReleaseDC(hdcSurf);
//return surface
return(lpdds);
}