S
Scrate
Unregistered / Unconfirmed
GUEST, unregistred user!
下面一段代码:
procedure TForm1.Button1Click(Sender: TObject);
var
dx:IDirectDraw;
sf:IDirectDrawSurface;
ddrval:HRESULT;
ddsd:TDDSurfaceDesc;
begin
ddrval:=DirectDrawCreate(nil, dx,nil);
ddrval:= dx.Setcooperativelevel(Handle,ddscl_normal);
ddrval:= dx.SetDisplayMode(640,480,16);
ZeroMemory(@ddsd, sizeof(ddsd));
ddsd.dwsize := sizeof(ddsd);
ddsd.dwflags := ddsd_caps;
ddsd.ddscaps.dwcaps :=DDSCAPS_PRIMARYSURFACE;
ddrval:= dx.createsurface(ddsd, sf, nil);
end;
运行时没事,退出程序时出错,提示"EAccessViolation"错误
请问这是为什么?该怎么办
procedure TForm1.Button1Click(Sender: TObject);
var
dx:IDirectDraw;
sf:IDirectDrawSurface;
ddrval:HRESULT;
ddsd:TDDSurfaceDesc;
begin
ddrval:=DirectDrawCreate(nil, dx,nil);
ddrval:= dx.Setcooperativelevel(Handle,ddscl_normal);
ddrval:= dx.SetDisplayMode(640,480,16);
ZeroMemory(@ddsd, sizeof(ddsd));
ddsd.dwsize := sizeof(ddsd);
ddsd.dwflags := ddsd_caps;
ddsd.ddscaps.dwcaps :=DDSCAPS_PRIMARYSURFACE;
ddrval:= dx.createsurface(ddsd, sf, nil);
end;
运行时没事,退出程序时出错,提示"EAccessViolation"错误
请问这是为什么?该怎么办