|
LPDIRECTDRAWSURFACE7 front;
且已设front为PRIMARYSURFACE,调用pDD7->CreateSurface时返回DDERR_NOTFOUND错误,是什么问题啊?
LPDIRECTDRAW7 pDD7;
HRESULT result;
LPDIRECTDRAWSURFACE7 front;
LPDIRECTDRAWSURFACE7 back;
LPDIRECTDRAWSURFACE7 logo;
DDSURFACEDESC2 desc;
result=DirectDrawCreateEx(NULL,(VOID**)&pDD7,IID_IDirectDraw7,NULL);
if(result!=DD_OK)
return -1;
result=pDD7->SetCooperativeLevel(m_hWnd,DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN|DDSCL_ALLOWREBOOT);
if(result!=DD_OK)
return -2;
result=pDD7->SetDisplayMode(800,600,16,0,DDSDM_STANDARDVGAMODE);
if(result!=DD_OK)
return -3;
memset(&desc,0,sizeof(desc));
desc.dwSize=sizeof(desc);
desc.dwFlags=DDSD_CAPS|DDSD_BACKBUFFERCOUNT;
desc.ddsCaps.dwCaps=DDSCAPS_PRIMARYSURFACE|DDSCAPS_COMPLEX|DDSCAPS_FLIP;
desc.dwBackBufferCount=1;
result = pDD7->CreateSurface(&desc,&front,NULL);
if(result!=DD_OK)
return -4;
DDSCAPS2 caps;
caps.dwCaps=DDSCAPS_BACKBUFFER;
result = front->GetAttachedSurface(&caps,&back);
if(result!=DD_OK)
{
if(result==DDERR_INVALIDOBJECT)
return 1;
if(result==DDERR_SURFACELOST)
return 2;
if(result==DDERR_INVALIDPARAMS)
return 3;
if(result==DDERR_NOTFOUND)
return 4;
}
memset(&desc,0,sizeof(desc));
desc.dwSize=sizeof(desc);
desc.dwFlags=DDSD_CAPS|DDSD_HEIGHT|DDSD_WIDTH;
desc.ddsCaps.dwCaps=DDSCAPS_OFFSCREENPLAIN;
desc.dwHeight=480;
desc.dwWidth=640;
result = pDD7->CreateSurface(&desc,&logo,NULL);
if(result!=DD_OK)
return -6; |
|