|
楼主 |
发表于 2003-8-1 12:00:00
|
显示全部楼层
Re: Re:我在写。NET程序时出现的问题:
#include <ddraw.h>
LPDIRECTDRAW7 lpDD;
LPDIRECTDRAWSURFACE7 lpDDSPrimary;
LPDIRECTDRAWSURFACE7 lpDDSBuffer;
LPDIRECTDRAWSURFACE7 lpDDSBack;
BOOL INITDDraw()
{
DDSURFACEDESC2 ddsd;
if(DirectdrawCreateEx(NULL,(void**)&lpDD,IID_IDirectDraw7,NULL)!=DD_OK)
return FALSE ;
if(lpDD->SetCooperativeLevel(hwnd,DDSCL_EXCLUSIVE|DDSCL_FULLSCREEN)!=DD_OK )
return FALSE;
if(lpDD->SetDisplayMode(640,480,32,0,DDSDM_STANDARDVGAMODE)!=DD_OK)
return FALSE;
memset(&ddsd,0,sizeof(DDSURFACEDESC2));
ddsd.dwSize=sizeof(ddsd);
ddsd.dwFlags=DDSD_CAPS|DDSD_BACKBUFFERCOUNT;
ddsd.ddsCaps.dwCaps=DDSCAPS_PRIMARYSURFACE|DDSCAPS_FLIP|DDSCAPS_COMPLEX;
ddsd.dwBackBufferCount=1;
if(lpDD->CreateSurface(&ddsd,&lpDDSPrimary,NULL )!=DD_OK)
return FALSE;
ddsd.ddsCaps.dwCaps=DDSCAPS_BACKBUFFER;
if(DD_OK!=lpDDSPrimary->GetAttachedSurface(&ddsd.ddsCaps,&lpDDSBuffer))
return FALSE;
ddsd.dwSize=sizeof(ddsd);
ddsd.dwFlags=DDSD_CAPS|DDSD_WIDTH|DDSD_HEIGHT;
ddsd.ddsCaps.dwCaps=DDSCAPS_OFFSCREENPLAIN;
ddsd.dwHeight=480;
ddsd.dwWidth=640;
if(DD_OK!=lpDD->CreateSurface(&ddsd,&lpDDSBack,NULL))
return FALSE;
return TRUE;
}
以上是我按资料上写的!!谢谢 |
|