本人最近学习DirectX的是用.通过例子发现如下的写法
pDDraw.QueryInterface(IID_IDIRECTDRAW4,FDD); //pDDraw为IDirectDraw FDD为IDirectDraw4
编译时报错.要更改为如下形式
pDDraw^.QueryInterface(pDDraw,IID_IDIRECTDRAW4,FDD);便可以正常使用.
我猜测可能是使用的DirectDraw.dcu的问题,我用的是Erik Unger的Jan 4th,2000版的DirectDraw.pas编译成的dcu
后来我使用Erik Unger的Sep 10th,2000版的DirectDraw.pas(也是目前directx for delphi中通用的unit)则不能通过编译.
出错的地方为以下几处:
var
NilGUID : TGUID absolute 0; //[Error] DirectDraw.pas(80): Variable name expected...case integer of
0: (
dwZDestConst : DWORD // Constant to use as Z buffer for dest
);
1: (
lpDDSZBufferDest : PDirectDrawSurface; //[Error] DirectDraw.pas(173): Type 'IDirectDrawSurface' needs finalization - not allowed in variant record...
我使用的是Win98/Delphi7/DirectX7.虽然使用以前的dcu可以完成DirectX7.0的功能,但是我想知道为什么这个有问题
pDDraw.QueryInterface(IID_IDIRECTDRAW4,FDD); //pDDraw为IDirectDraw FDD为IDirectDraw4
编译时报错.要更改为如下形式
pDDraw^.QueryInterface(pDDraw,IID_IDIRECTDRAW4,FDD);便可以正常使用.
我猜测可能是使用的DirectDraw.dcu的问题,我用的是Erik Unger的Jan 4th,2000版的DirectDraw.pas编译成的dcu
后来我使用Erik Unger的Sep 10th,2000版的DirectDraw.pas(也是目前directx for delphi中通用的unit)则不能通过编译.
出错的地方为以下几处:
var
NilGUID : TGUID absolute 0; //[Error] DirectDraw.pas(80): Variable name expected...case integer of
0: (
dwZDestConst : DWORD // Constant to use as Z buffer for dest
);
1: (
lpDDSZBufferDest : PDirectDrawSurface; //[Error] DirectDraw.pas(173): Type 'IDirectDrawSurface' needs finalization - not allowed in variant record...
我使用的是Win98/Delphi7/DirectX7.虽然使用以前的dcu可以完成DirectX7.0的功能,但是我想知道为什么这个有问题
但是后边Erik注释是这样的
// Delphi 5 can't handle interface in variant records
// so we have to use pointers instead (which can be type-casted into interfaces):{$IFDEF VER130}
PDirectDrawSurface = Pointer;
{$ELSE}
{$IFDEF VER140} // D6, TP 14
PDirectDrawSurface = Pointer;
{$ELSE}
PDirectDrawSurface = IDirectDrawSurface;
{$ENDIF}
{$ENDIF}
我用的不是Delphi5啊,是不是我要打开/关闭什么编译选项?
改成VER150就行了