IDirect3DDevice9 Interface

 

 

' ****************************************************************************************
' IDirect3DDevice9 interface
' $IID_IDirect3DDevice9 = GUID$("{D0223B96-BF7A-43fd-92BD-A43B0D82B9EB}")
' ****************************************************************************************

' ****************************************************************************************
' Applications use the methods of the IDirect3DDevice9 interface to perform DrawPrimitive-based
' rendering, create resources, work with system-level variables, adjust gamma ramp levels, work
' with palettes, and create shaders.
' Remarks
' The IDirect3DDevice9 interface is obtained by calling the IDirect3D9::CreateDevice method.
' Interface Information
'    Stock Implementation   d3d9.dll
'    Custom Implementation  No
'    Inherits from  IUnknown
'    Header     d3d9.h
'    Import library     d3d9.lib
'    Minimum operating systems  Windows 98
' ****************************************************************************************

' ****************************************************************************************
'DECLARE_INTERFACE_(IDirect3DDevice9, IUnknown)
'{
'    /*** IUnknown methods ***/
'   0.  STDMETHOD(QueryInterface)(THIS_ REFIID riid, void** ppvObj) PURE;
'   1.  STDMETHOD_(ULONG,AddRef)(THIS) PURE;
'   2.  STDMETHOD_(ULONG,Release)(THIS) PURE;

'    /*** IDirect3DDevice9 methods ***/
'   3.  STDMETHOD(TestCooperativeLevel)(THIS) PURE;
'   4.  STDMETHOD_(UINT, GetAvailableTextureMem)(THIS) PURE;
'   5.  STDMETHOD(EvictManagedResources)(THIS) PURE;
'   6.  STDMETHOD(GetDirect3D)(THIS_ IDirect3D9** ppD3D9) PURE;
'   7.  STDMETHOD(GetDeviceCaps)(THIS_ D3DCAPS9* pCaps) PURE;
'   8.  STDMETHOD(GetDisplayMode)(THIS_ UINT iSwapChain,D3DDISPLAYMODE* pMode) PURE;
'   9.  STDMETHOD(GetCreationParameters)(THIS_ D3DDEVICE_CREATION_PARAMETERS *pParameters) PURE;
'  10.  STDMETHOD(SetCursorProperties)(THIS_ UINT XHotSpot,UINT YHotSpot,IDirect3DSurface9* pCursorBitmap) PURE;
'  11.  STDMETHOD_(void, SetCursorPosition)(THIS_ int X,int Y,DWORD Flags) PURE;
'  12.  STDMETHOD_(BOOL, ShowCursor)(THIS_ BOOL bShow) PURE;
'  13.  STDMETHOD(CreateAdditionalSwapChain)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters,IDirect3DSwapChain9** pSwapChain) PURE;
'  14.  STDMETHOD(GetSwapChain)(THIS_ UINT iSwapChain,IDirect3DSwapChain9** pSwapChain) PURE;
'  15.  STDMETHOD_(UINT, GetNumberOfSwapChains)(THIS) PURE;
'  16.  STDMETHOD(Reset)(THIS_ D3DPRESENT_PARAMETERS* pPresentationParameters) PURE;
'  17.  STDMETHOD(Present)(THIS_ CONST RECT* pSourceRect,CONST RECT* pDestRect,HWND hDestWindowOverride,CONST RGNDATA* pDirtyRegion) PURE;
'  18.  STDMETHOD(GetBackBuffer)(THIS_ UINT iSwapChain,UINT iBackBuffer,D3DBACKBUFFER_TYPE Type,IDirect3DSurface9** ppBackBuffer) PURE;
'  19.  STDMETHOD(GetRasterStatus)(THIS_ UINT iSwapChain,D3DRASTER_STATUS* pRasterStatus) PURE;
'  20.  STDMETHOD(SetDialogBoxMode)(THIS_ BOOL bEnableDialogs) PURE;
'  21.  STDMETHOD_(void, SetGammaRamp)(THIS_ UINT iSwapChain,DWORD Flags,CONST D3DGAMMARAMP* pRamp) PURE;
'  22.  STDMETHOD_(void, GetGammaRamp)(THIS_ UINT iSwapChain,D3DGAMMARAMP* pRamp) PURE;
'  23.  STDMETHOD(CreateTexture)(THIS_ UINT Width,UINT Height,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DTexture9** ppTexture,HANDLE* pSharedHandle) PURE;
'  24.  STDMETHOD(CreateVolumeTexture)(THIS_ UINT Width,UINT Height,UINT Depth,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DVolumeTexture9** ppVolumeTexture,HANDLE* pSharedHandle) PURE;
'  25.  STDMETHOD(CreateCubeTexture)(THIS_ UINT EdgeLength,UINT Levels,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DCubeTexture9** ppCubeTexture,HANDLE* pSharedHandle) PURE;
'  26.  STDMETHOD(CreateVertexBuffer)(THIS_ UINT Length,DWORD Usage,DWORD FVF,D3DPOOL Pool,IDirect3DVertexBuffer9** ppVertexBuffer,HANDLE* pSharedHandle) PURE;
'  27.  STDMETHOD(CreateIndexBuffer)(THIS_ UINT Length,DWORD Usage,D3DFORMAT Format,D3DPOOL Pool,IDirect3DIndexBuffer9** ppIndexBuffer,HANDLE* pSharedHandle) PURE;
'  28.  STDMETHOD(CreateRenderTarget)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Lockable,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE;
'  29.  STDMETHOD(CreateDepthStencilSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DMULTISAMPLE_TYPE MultiSample,DWORD MultisampleQuality,BOOL Discard,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE;
'  30.  STDMETHOD(UpdateSurface)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestinationSurface,CONST POINT* pDestPoint) PURE;
'  31.  STDMETHOD(UpdateTexture)(THIS_ IDirect3DBaseTexture9* pSourceTexture,IDirect3DBaseTexture9* pDestinationTexture) PURE;
'  32.  STDMETHOD(GetRenderTargetData)(THIS_ IDirect3DSurface9* pRenderTarget,IDirect3DSurface9* pDestSurface) PURE;
'  33.  STDMETHOD(GetFrontBufferData)(THIS_ UINT iSwapChain,IDirect3DSurface9* pDestSurface) PURE;
'  34.  STDMETHOD(StretchRect)(THIS_ IDirect3DSurface9* pSourceSurface,CONST RECT* pSourceRect,IDirect3DSurface9* pDestSurface,CONST RECT* pDestRect,D3DTEXTUREFILTERTYPE Filter) PURE;
'  35.  STDMETHOD(ColorFill)(THIS_ IDirect3DSurface9* pSurface,CONST RECT* pRect,D3DCOLOR color) PURE;
'  36.  STDMETHOD(CreateOffscreenPlainSurface)(THIS_ UINT Width,UINT Height,D3DFORMAT Format,D3DPOOL Pool,IDirect3DSurface9** ppSurface,HANDLE* pSharedHandle) PURE;
'  37.  STDMETHOD(SetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9* pRenderTarget) PURE;
'  38.  STDMETHOD(GetRenderTarget)(THIS_ DWORD RenderTargetIndex,IDirect3DSurface9** ppRenderTarget) PURE;
'  39.  STDMETHOD(SetDepthStencilSurface)(THIS_ IDirect3DSurface9* pNewZStencil) PURE;
'  40.  STDMETHOD(GetDepthStencilSurface)(THIS_ IDirect3DSurface9** ppZStencilSurface) PURE;
'  41.  STDMETHOD(BeginScene)(THIS) PURE;
'  42.  STDMETHOD(EndScene)(THIS) PURE;
'  43.  STDMETHOD(Clear)(THIS_ DWORD Count,CONST D3DRECT* pRects,DWORD Flags,D3DCOLOR Color,float Z,DWORD Stencil) PURE;
'  44.  STDMETHOD(SetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,CONST D3DMATRIX* pMatrix) PURE;
'  45.  STDMETHOD(GetTransform)(THIS_ D3DTRANSFORMSTATETYPE State,D3DMATRIX* pMatrix) PURE;
'  46.  STDMETHOD(MultiplyTransform)(THIS_ D3DTRANSFORMSTATETYPE,CONST D3DMATRIX*) PURE;
'  47.  STDMETHOD(SetViewport)(THIS_ CONST D3DVIEWPORT9* pViewport) PURE;
'  48.  STDMETHOD(GetViewport)(THIS_ D3DVIEWPORT9* pViewport) PURE;
'  49.  STDMETHOD(SetMaterial)(THIS_ CONST D3DMATERIAL9* pMaterial) PURE;
'  50.  STDMETHOD(GetMaterial)(THIS_ D3DMATERIAL9* pMaterial) PURE;
'  51.  STDMETHOD(SetLight)(THIS_ DWORD Index,CONST D3DLIGHT9*) PURE;
'  52.  STDMETHOD(GetLight)(THIS_ DWORD Index,D3DLIGHT9*) PURE;
'  53.  STDMETHOD(LightEnable)(THIS_ DWORD Index,BOOL Enable) PURE;
'  54.  STDMETHOD(GetLightEnable)(THIS_ DWORD Index,BOOL* pEnable) PURE;
'  55.  STDMETHOD(SetClipPlane)(THIS_ DWORD Index,CONST float* pPlane) PURE;
'  56.  STDMETHOD(GetClipPlane)(THIS_ DWORD Index,float* pPlane) PURE;
'  57.  STDMETHOD(SetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD Value) PURE;
'  58.  STDMETHOD(GetRenderState)(THIS_ D3DRENDERSTATETYPE State,DWORD* pValue) PURE;
'  59.  STDMETHOD(CreateStateBlock)(THIS_ D3DSTATEBLOCKTYPE Type,IDirect3DStateBlock9** ppSB) PURE;
'  60.  STDMETHOD(BeginStateBlock)(THIS) PURE;
'  61.  STDMETHOD(EndStateBlock)(THIS_ IDirect3DStateBlock9** ppSB) PURE;
'  62.  STDMETHOD(SetClipStatus)(THIS_ CONST D3DCLIPSTATUS9* pClipStatus) PURE;
'  63.  STDMETHOD(GetClipStatus)(THIS_ D3DCLIPSTATUS9* pClipStatus) PURE;
'  64.  STDMETHOD(GetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9** ppTexture) PURE;
'  65.  STDMETHOD(SetTexture)(THIS_ DWORD Stage,IDirect3DBaseTexture9* pTexture) PURE;
'  66.  STDMETHOD(GetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD* pValue) PURE;
'  67.  STDMETHOD(SetTextureStageState)(THIS_ DWORD Stage,D3DTEXTURESTAGESTATETYPE Type,DWORD Value) PURE;
'  68.  STDMETHOD(GetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD* pValue) PURE;
'  69.  STDMETHOD(SetSamplerState)(THIS_ DWORD Sampler,D3DSAMPLERSTATETYPE Type,DWORD Value) PURE;
'  70.  STDMETHOD(ValidateDevice)(THIS_ DWORD* pNumPasses) PURE;
'  71.  STDMETHOD(SetPaletteEntries)(THIS_ UINT PaletteNumber,CONST PALETTEENTRY* pEntries) PURE;
'  72.  STDMETHOD(GetPaletteEntries)(THIS_ UINT PaletteNumber,PALETTEENTRY* pEntries) PURE;
'  73.  STDMETHOD(SetCurrentTexturePalette)(THIS_ UINT PaletteNumber) PURE;
'  74.  STDMETHOD(GetCurrentTexturePalette)(THIS_ UINT *PaletteNumber) PURE;
'  75.  STDMETHOD(SetScissorRect)(THIS_ CONST RECT* pRect) PURE;
'  76.  STDMETHOD(GetScissorRect)(THIS_ RECT* pRect) PURE;
'  77.  STDMETHOD(SetSoftwareVertexProcessing)(THIS_ BOOL bSoftware) PURE;
'  78.  STDMETHOD_(BOOL, GetSoftwareVertexProcessing)(THIS) PURE;
'  79.  STDMETHOD(SetNPatchMode)(THIS_ float nSegments) PURE;
'  80.  STDMETHOD_(float, GetNPatchMode)(THIS) PURE;
'  81.  STDMETHOD(DrawPrimitive)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT StartVertex,UINT PrimitiveCount) PURE;
'  82.  STDMETHOD(DrawIndexedPrimitive)(THIS_ D3DPRIMITIVETYPE,INT BaseVertexIndex,UINT MinVertexIndex,UINT NumVertices,UINT startIndex,UINT primCount) PURE;
'  83.  STDMETHOD(DrawPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT PrimitiveCount,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE;
'  84.  STDMETHOD(DrawIndexedPrimitiveUP)(THIS_ D3DPRIMITIVETYPE PrimitiveType,UINT MinVertexIndex,UINT NumVertices,UINT PrimitiveCount,CONST void* pIndexData,D3DFORMAT IndexDataFormat,CONST void* pVertexStreamZeroData,UINT VertexStreamZeroStride) PURE;
'  85.  STDMETHOD(ProcessVertices)(THIS_ UINT SrcStartIndex,UINT DestIndex,UINT VertexCount,IDirect3DVertexBuffer9* pDestBuffer,IDirect3DVertexDeclaration9* pVertexDecl,DWORD Flags) PURE;
'  86.  STDMETHOD(CreateVertexDeclaration)(THIS_ CONST D3DVERTEXELEMENT9* pVertexElements,IDirect3DVertexDeclaration9** ppDecl) PURE;
'  87.  STDMETHOD(SetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9* pDecl) PURE;
'  88.  STDMETHOD(GetVertexDeclaration)(THIS_ IDirect3DVertexDeclaration9** ppDecl) PURE;
'  89.  STDMETHOD(SetFVF)(THIS_ DWORD FVF) PURE;
'  90.  STDMETHOD(GetFVF)(THIS_ DWORD* pFVF) PURE;
'  91.  STDMETHOD(CreateVertexShader)(THIS_ CONST DWORD* pFunction,IDirect3DVertexShader9** ppShader) PURE;
'  92.  STDMETHOD(SetVertexShader)(THIS_ IDirect3DVertexShader9* pShader) PURE;
'  93.  STDMETHOD(GetVertexShader)(THIS_ IDirect3DVertexShader9** ppShader) PURE;
'  94.  STDMETHOD(SetVertexShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE;
'  95.  STDMETHOD(GetVertexShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE;
'  96.  STDMETHOD(SetVertexShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE;
'  97.  STDMETHOD(GetVertexShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE;
'  98.  STDMETHOD(SetVertexShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT  BoolCount) PURE;
'  99.  STDMETHOD(GetVertexShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE;
' 100.  STDMETHOD(SetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9* pStreamData,UINT OffsetInBytes,UINT Stride) PURE;
' 101.  STDMETHOD(GetStreamSource)(THIS_ UINT StreamNumber,IDirect3DVertexBuffer9** ppStreamData,UINT* pOffsetInBytes,UINT* pStride) PURE;
' 102.  STDMETHOD(SetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT Setting) PURE;
' 103.  STDMETHOD(GetStreamSourceFreq)(THIS_ UINT StreamNumber,UINT* pSetting) PURE;
' 104.  STDMETHOD(SetIndices)(THIS_ IDirect3DIndexBuffer9* pIndexData) PURE;
' 105.  STDMETHOD(GetIndices)(THIS_ IDirect3DIndexBuffer9** ppIndexData) PURE;
' 106.  STDMETHOD(CreatePixelShader)(THIS_ CONST DWORD* pFunction,IDirect3DPixelShader9** ppShader) PURE;
' 107.  STDMETHOD(SetPixelShader)(THIS_ IDirect3DPixelShader9* pShader) PURE;
' 108.  STDMETHOD(GetPixelShader)(THIS_ IDirect3DPixelShader9** ppShader) PURE;
' 109.  STDMETHOD(SetPixelShaderConstantF)(THIS_ UINT StartRegister,CONST float* pConstantData,UINT Vector4fCount) PURE;
' 110.  STDMETHOD(GetPixelShaderConstantF)(THIS_ UINT StartRegister,float* pConstantData,UINT Vector4fCount) PURE;
' 111.  STDMETHOD(SetPixelShaderConstantI)(THIS_ UINT StartRegister,CONST int* pConstantData,UINT Vector4iCount) PURE;
' 112.  STDMETHOD(GetPixelShaderConstantI)(THIS_ UINT StartRegister,int* pConstantData,UINT Vector4iCount) PURE;
' 113.  STDMETHOD(SetPixelShaderConstantB)(THIS_ UINT StartRegister,CONST BOOL* pConstantData,UINT  BoolCount) PURE;
' 114.  STDMETHOD(GetPixelShaderConstantB)(THIS_ UINT StartRegister,BOOL* pConstantData,UINT BoolCount) PURE;
' 115.  STDMETHOD(DrawRectPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DRECTPATCH_INFO* pRectPatchInfo) PURE;
' 116.  STDMETHOD(DrawTriPatch)(THIS_ UINT Handle,CONST float* pNumSegs,CONST D3DTRIPATCH_INFO* pTriPatchInfo) PURE;
' 117.  STDMETHOD(DeletePatch)(THIS_ UINT Handle) PURE;
' 118.  STDMETHOD(CreateQuery)(THIS_ D3DQUERYTYPE Type,IDirect3DQuery9** ppQuery) PURE;
'};
' ****************************************************************************************

' ****************************************************************************************
' TestCooperativeLevel method
' Reports the current cooperative-level status of the Microsoft® Direct3D® device for a
' windowed or full-screen application.
' HRESULT TestCooperativeLevel();
' ****************************************************************************************
FUNCTION IDirect3DDevice9_TestCooperativeLevel ALIAS "IDirect3DDevice9_TestCooperativeLevel" (BYVAL pthis AS DWORD PTR) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[3] USING IDirect3DDevice9_TestCooperativeLevel(pthis) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetAvailableTextureMem method
' Returns an estimate of the amount of available texture memory.
' UINT GetAvailableTextureMem();
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetAvailableTextureMem ALIAS "IDirect3DDevice9_GetAvailableTextureMem" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD

    LOCAL DWRESULT AS DWORD
    IF pthis = %NULL THEN EXIT FUNCTION
    CALL DWORD @@pthis[4] USING IDirect3DDevice9_GetAvailableTextureMem(pthis) TO DWRESULT
    FUNCTION = DWRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' EvictManagedResources method
' Evicts all managed resources, including both Microsoft Direct3D and driver-managed
' resources.
' HRESULT EvictManagedResources();
' ****************************************************************************************
FUNCTION IDirect3DDevice9_EvictManagedResources ALIAS "IDirect3DDevice9_EvictManagedResources" (BYVAL pthis AS DWORD PTR) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[5] USING IDirect3DDevice9_EvictManagedResources(pthis) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetDirect3D method
' Returns an interface to the instance of the Microsoft Direct3D object that created the
' device.
' Note   Calling this method will increase the internal reference count on the IDirect3D9
' interface. Failure to call IUnknown::Release when finished using this IDirect3D9
' interface results in a memory leak.
' HRESULT GetDirect3D(
'   IDirect3D9 ** ppD3D9
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetDirect3D ALIAS "IDirect3DDevice9_GetDirect3D" ( _
    BYVAL pthis AS DWORD PTR, BYREF ppD3D9 AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[6] USING IDirect3DDevice9_GetDirect3D(pthis, ppD3D9) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetDeviceCaps method
' Retrieves the capabilities of the rendering device.
' HRESULT GetDeviceCaps(
'   D3DCAPS9 * pCaps
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetDeviceCaps ALIAS "IDirect3DDevice9_GetDeviceCaps" ( _
    BYVAL pthis AS DWORD PTR, BYREF pCaps AS D3DCAPS9) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[7] USING IDirect3DDevice9_GetDeviceCaps(pthis, pCaps) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetDisplayMode method
' Retrieves the display mode's spatial resolution, color resolution, and refresh frequency.
' HRESULT GetDisplayMode(
'   UINT  iSwapChain,
'   D3DDISPLAYMODE * pMode
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetDisplayMode ALIAS "IDirect3DDevice9_GetDisplayMode" ( _
    BYVAL pthis AS DWORD PTR, BYVAL iSwapChain AS DWORD, BYREF pMode AS D3DDISPLAYMODE) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[8] USING IDirect3DDevice9_GetDisplayMode(pthis, iSwapChain, pMode) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetCreationParameters method
' Retrieves the creation parameters of the device.
' HRESULT GetCreationParameters(
'   D3DDEVICE_CREATION_PARAMETERS * pParameters
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetCreationParameters ALIAS "IDirect3DDevice9_GetCreationParameters" ( _
    BYVAL pthis AS DWORD PTR, BYREF pCreationParams AS D3DDEVICE_CREATION_PARAMETERS) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[9] USING IDirect3DDevice9_GetCreationParameters(pthis, pCreationParams) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetCursorProperties method
' Sets properties for the cursor.
' HRESULT SetCursorProperties(
'   UINT XHotSpot,
'   UINT YHotSpot,
'   IDirect3DSurface9 * pCursorBitmap
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_SetCursorProperties ALIAS "IDirect3DDevice9_SetCursorProperties" ( _
    BYVAL pthis AS DWORD PTR, BYVAL xHotSpot AS DWORD, BYVAL yHotSpot AS DWORD, _
    BYVAL pCursorBitmap AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[10] USING IDirect3DDevice9_SetCursorProperties(pthis, xHotSpot, yHotSpot, pCursorBitmap) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetCursorPosition method
' Sets the cursor position and update options.
' void SetCursorPosition(
'   INT X,
'   INT Y,
'   DWORD Flags
' );
' ****************************************************************************************
SUB IDirect3DDevice9_SetCursorPosition ALIAS "IDirect3DDevice9_SetCursorPosition" ( _
    BYVAL pthis AS DWORD PTR, BYVAL X AS LONG, BYVAL Y AS LONG, BYVAL Flags AS DWORD) EXPORT

    IF pthis = %NULL THEN EXIT SUB
    CALL DWORD @@pthis[11] USING IDirect3DDevice9_SetCursorPosition(pthis, X, Y, Flags)

END SUB
' ****************************************************************************************

' ****************************************************************************************
' ShowCursor method
' Displays or hides the cursor.
' BOOL ShowCursor(
'   BOOL bShow
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_ShowCursor ALIAS "IDirect3DDevice9_ShowCursor" ( _
    BYVAL pthis AS DWORD PTR, BYVAL bShow AS LONG) EXPORT AS LONG

    LOCAL LRESULT AS LONG
    IF pthis = %NULL THEN EXIT FUNCTION
    CALL DWORD @@pthis[12] USING IDirect3DDevice9_ShowCursor(pthis, bShow) TO LRESULT
    FUNCTION = LRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' CreateAdditionalSwapChain method
' Creates an additional swap chain for rendering multiple views.
' HRESULT CreateAdditionalSwapChain(
'   D3DPRESENT_PARAMETERS* pPresentationParameters,
'   IDirect3DSwapChain9** ppSwapChain
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_CreateAdditionalSwapChain ALIAS "IDirect3DDevice9_CreateAdditionalSwapChain" ( _
    BYVAL pthis AS DWORD PTR, BYREF pPresentationParameters AS D3DPRESENT_PARAMETERS, _
    BYREF ppSwapChain AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[13] USING IDirect3DDevice9_CreateAdditionalSwapChain(pthis, pPresentationParameters, ppSwapChain) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetSwapChain method
' Gets a pointer to a swap chain.
' HRESULT GetSwapChain(
'   UINT  iSwapChain,
'   IDirect3DSwapChain9 ** ppSwapChain
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetSwapChain ALIAS "IDirect3DDevice9_GetSwapChain" ( _
    BYVAL pthis AS DWORD PTR, BYVAL iSwapChain AS DWORD, BYREF ppSwapChain AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[14] USING IDirect3DDevice9_GetSwapChain(pthis, iSwapChain, ppSwapChain) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetNumberOfSwapChains method
' Gets the number of implicit swap chains.
' UINT GetNumberOfSwapChains();
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetNumberOfSwapChains ALIAS "IDirect3DDevice9_GetNumberOfSwapChains" (BYVAL pthis AS DWORD PTR) EXPORT AS DWORD

    LOCAL DWRESULT AS DWORD
    IF pthis = %NULL THEN EXIT FUNCTION
    CALL DWORD @@pthis[15] USING IDirect3DDevice9_GetNumberOfSwapChains(pthis) TO DWRESULT
    FUNCTION = DWRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Reset method
' Resets the type, size, and format of the swap chain.
' HRESULT Reset(
'   D3DPRESENT_PARAMETERS* pPresentationParameters
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_Reset ALIAS "IDirect3DDevice9_Reset" ( _
    BYVAL pthis AS DWORD PTR, BYREF pPresentationParameters AS D3DPRESENT_PARAMETERS) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[16] USING IDirect3DDevice9_Reset(pthis, pPresentationParameters) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Present method
' Presents the contents of the next in the sequence of back buffers owned by the device.
' HRESULT Present(
'   CONST RECT * pSourceRect,
'   CONST RECT * pDestRect,
'   HWND hDestWindowOverride,
'   CONST RGNDATA * pDirtyRegion
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_Present ALIAS "IDirect3DDevice9_Present" ( _
    BYVAL pthis AS DWORD PTR, BYREF pSourceRect AS RECT, BYREF pDestRect AS RECT, _
    BYVAL hWndDestWindowOverride AS DWORD, BYVAL pDirtyRegion AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[17] USING IDirect3DDevice9_Present(pthis, pSourceRect, pDestRect, hWndDestWindowOverride, pDirtyRegion) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetBackBuffer method
' Retrieves a back buffer from the device's swap chain
' Note  Calling this method will increase the internal reference count on the
' IDirect3DSurface8 interface. Failure to call IUnknown::Release when finished using this
' IDirect3DSurface8 interface results in a memory leak.
' HRESULT GetBackBuffer(
'   UINT  iSwapChain,
'   UINT BackBuffer,
'   D3DBACKBUFFER_TYPE Type,
'   IDirect3DSurface9 ** ppBackBuffer
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetBackBuffer ALIAS "IDirect3DDevice9_GetBackBuffer" ( _
    BYVAL pthis AS DWORD PTR, BYVAL iSwapChain AS DWORD, BYVAL BackBuffer AS DWORD, _
    BYVAL BufferType AS DWORD, BYREF ppBackBuffer AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[18] USING IDirect3DDevice9_GetBackBuffer(pthis, iSwapChain, BackBuffer, BufferType, ppBackBuffer) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetRasterStatus method
' Returns information describing the raster of the monitor on which the swap chain is
' presented.
' HRESULT GetRasterStatus(
'   UINT  iSwapChain,
'   D3DRASTER_STATUS * pRasterStatus
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetRasterStatus ALIAS "IDirect3DDevice9_GetRasterStatus" ( _
    BYVAL pthis AS DWORD PTR, BYVAL iSwapChain AS DWORD, _
    BYREF pRasterStatus AS D3DRASTER_STATUS) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[19] USING IDirect3DDevice9_GetRasterStatus(pthis, iSwapChain, pRasterStatus) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetDialogBoxMode method
' This method allows the use of Microsoft Windows Graphics Device Interface (GDI) dialog
' boxes in full-screen mode applications.
' HRESULT SetDialogBoxMode(
'   BOOL bEnableDialogs
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_SetDialogBoxMode ALIAS "IDirect3DDevice9_SetDialogBoxMode" ( _
    BYVAL pthis AS DWORD PTR, BYVAL bEnableDialogs AS LONG) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[20] USING IDirect3DDevice9_SetDialogBoxMode(pthis, bEnableDialogs) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetGammaRamp method
' Sets the gamma correction ramp for the implicit swap chain. This method will affect the
' entire screen (not just the active window if you are running in windowed mode).
' void SetGammaRamp(
'   UINT  iSwapChain,
'   DWORD Flags,
'   CONST D3DGAMMARAMP * pRamp
' );
' ****************************************************************************************
SUB IDirect3DDevice9_SetGammaRamp ALIAS "IDirect3DDevice9_SetGammaRamp" ( _
    BYVAL pthis AS DWORD PTR, BYVAL iSwapChain AS DWORD, _
    BYVAL Flags AS DWORD, BYREF pRamp AS D3DGAMMARAMP) EXPORT

    IF pthis = %NULL THEN EXIT SUB
    CALL DWORD @@pthis[21] USING IDirect3DDevice9_SetGammaRamp(pthis, iSwapChain, Flags, pRamp)

END SUB
' ****************************************************************************************

' ****************************************************************************************
' GetGammaRamp method
' Retrieves the gamma correction ramp for the swap chain.
' void GetGammaRamp(
'   UINT  iSwapChain,
'   D3DGAMMARAMP * pRamp
' );
' ****************************************************************************************
SUB IDirect3DDevice9_GetGammaRamp ALIAS "IDirect3DDevice9_GetGammaRamp" ( _
    BYVAL pthis AS DWORD PTR, BYVAL iSwapChain AS DWORD, BYREF pRamp AS D3DGAMMARAMP) EXPORT

    IF pthis = %NULL THEN EXIT SUB
    CALL DWORD @@pthis[22] USING IDirect3DDevice9_GetGammaRamp(pthis, iSwapChain, pRamp)

END SUB
' ****************************************************************************************

' ****************************************************************************************
' CreateTexture method
' Creates a texture resource.
' HRESULT CreateTexture(
'   UINT Width,
'   UINT Height,
'   UINT Levels,
'   DWORD Usage,
'   D3DFORMAT Format,
'   D3DPOOL Pool,
'   IDirect3DTexture9** ppTexture,
'   HANDLE* pSharedHandle
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_CreateTexture ALIAS "IDirect3DDevice9_CreateTexture" ( _
    BYVAL pthis AS DWORD PTR, BYVAL prmWidth AS DWORD, BYVAL Height AS DWORD, _
    BYVAL Levels AS DWORD, BYVAL Usage AS DWORD, BYVAL prmFormat AS DWORD, _
    BYVAL Pool AS DWORD, BYREF ppTexture AS DWORD, BYVAL pSharedHandle AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[23] USING IDirect3DDevice9_CreateTexture(pthis, prmWidth, Height, Levels, Usage, prmFormat, Pool, ppTexture, pSharedHandle) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' CreateVolumeTexture method
' Creates a volume texture resource.
' HRESULT CreateVolumeTexture(
'   UINT Width,
'   UINT Height,
'   UINT Depth,
'   UINT Levels,
'   DWORD Usage,
'   D3DFORMAT Format,
'   D3DPOOL Pool,
'   IDirect3DVolumeTexture9** ppVolumeTexture,
'   HANDLE* pSharedHandle
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_CreateVolumeTexture ALIAS "IDirect3DDevice9_CreateVolumeTexture" ( _
    BYVAL pthis AS DWORD PTR, BYVAL prmWidth AS DWORD, BYVAL Height AS DWORD, _
    BYVAL Depth AS DWORD, BYVAL Levels AS DWORD, BYVAL Usage AS DWORD, _
    BYVAL prmFormat AS DWORD, BYVAL Pool AS DWORD, BYREF ppVolumeTexture AS DWORD, _
    BYVAL pSharedHandle AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[24] USING IDirect3DDevice9_CreateVolumeTexture(pthis, prmWidth, Height, Depth, Levels, Usage, prmFormat, Pool, ppVolumeTexture, pSharedHandle) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' CreateCubeTexture method
' Creates a cube texture resource.
' HRESULT CreateCubeTexture(
'   UINT EdgeLength,
'   UINT Levels,
'   DWORD Usage,
'   D3DFORMAT Format,
'   D3DPOOL Pool,
'   IDirect3DCubeTexture9 ** ppCubeTexture,
'   HANDLE* pSharedHandle
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_CreateCubeTexture ALIAS "IDirect3DDevice9_CreateCubeTexture" ( _
    BYVAL pthis AS DWORD PTR, BYVAL EdgeLength AS DWORD, BYVAL Levels AS DWORD, _
    BYVAL Usage AS DWORD, BYVAL prmFormat AS DWORD, BYVAL Pool AS DWORD, _
    BYREF ppCubeTexture AS DWORD, BYVAL pSharedHandle AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[25] USING IDirect3DDevice9_CreateCubeTexture(pthis, EdgeLength, Levels, Usage, prmFormat, Pool, ppCubeTexture, pSharedHandle) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' CreateVertexBuffer method
' Creates a vertex buffer.
' HRESULT CreateVertexBuffer(
'   UINT Length,
'   DWORD Usage,
'   DWORD FVF,
'   D3DPOOL Pool,
'   IDirect3DVertexBuffer9** ppVertexBuffer,
'   HANDLE* pSharedHandle
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_CreateVertexBuffer ALIAS "IDirect3DDevice9_CreateVertexBuffer" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Length AS DWORD, BYVAL Usage AS DWORD, _
    BYVAL FVF AS DWORD, BYVAL Pool AS DWORD, BYREF ppVertexBuffer AS DWORD, _
    BYVAL pShareHandle AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[26] USING IDirect3DDevice9_CreateVertexBuffer(pthis, Length, Usage, FVF, Pool, ppVertexBuffer, pShareHandle) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' CreateIndexBuffer method
' Creates an index buffer.
' HRESULT CreateIndexBuffer(
'   UINT Length,
'   DWORD Usage,
'   D3DFORMAT Format,
'   D3DPOOL Pool,
'   IDirect3DIndexBuffer9** ppIndexBuffer,
'   HANDLE* pSharedHandle
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_CreateIndexBuffer ALIAS "IDirect3DDevice9_CreateIndexBuffer" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Length AS DWORD, BYVAL Usage AS DWORD, _
    BYVAL prmFormat AS DWORD, BYVAL Pool AS DWORD, BYREF ppIndexBuffer AS DWORD, _
    BYVAL pSharedHandle AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[27] USING IDirect3DDevice9_CreateIndexBuffer(pthis, Length, Usage, prmFormat, Pool, ppIndexBuffer, pSharedHandle) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' CreateRenderTarget method
' Creates a render-target surface.
' HRESULT CreateRenderTarget(
'   UINT Width,
'   UINT Height,
'   D3DFORMAT Format,
'   D3DMULTISAMPLE_TYPE MultiSample,
'   DWORD MultisampleQuality,
'   BOOL Lockable,
'   IDirect3DSurface9** ppSurface,
'   HANDLE* pSharedHandle
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_CreateRenderTarget ALIAS "IDirect3DDevice9_CreateRenderTarget" ( _
    BYVAL pthis AS DWORD PTR, BYVAL prmWidth AS DWORD, BYVAL Height AS DWORD, _
    BYVAL prmFormat AS DWORD, BYVAL MultiSample AS DWORD, BYVAL MultiSampleQuality AS DWORD, _
    BYVAL Lockable AS LONG, BYREF ppSurface AS DWORD, BYVAL pSharedHandle AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[28] USING IDirect3DDevice9_CreateRenderTarget(pthis, prmWidth, Height, prmFormat, MultiSample, MultiSampleQuality, Lockable, ppSurface, pSharedHandle) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' CreateDepthStencilSurface method
' Creates a depth-stencil resource.
' HRESULT CreateDepthStencilSurface(
'   UINT Width,
'   UINT Height,
'   D3DFORMAT Format,
'   D3DMULTISAMPLE_TYPE MultiSample,
'   DWORD MultisampleQuality,
'   BOOL Discard,
'   IDirect3DSurface9** ppSurface,
'   HANDLE* pSharedHandle
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_CreateDepthStencilSurface ALIAS "IDirect3DDevice9_CreateDepthStencilSurface" ( _
    BYVAL pthis AS DWORD PTR, BYVAL prmWidth AS DWORD, BYVAL Height AS DWORD, _
    BYVAL prmFormat AS DWORD, BYVAL MultiSample AS DWORD, BYVAL MultiSampleQuality AS DWORD, _
    BYVAL Discard AS LONG, BYREF ppSurface AS DWORD, BYVAL pSharedHandle AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[29] USING IDirect3DDevice9_CreateDepthStencilSurface(pthis, prmWidth, Height, prmFormat, MultiSample, MultisampleQuality, Discard, ppSurface, pSharedHandle) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' UpdateSurface Method
' Copies rectangular subsets of pixels from one surface to another.
' HRESULT UpdateSurface(
'   IDirect3DSurface9* pSourceSurface,
'   CONST RECT* pSourceRect,
'   IDirect3DSurface9* pDestinationSurface,
'   CONST POINT* pDestinationPoint
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_UpdateSurface ALIAS "IDirect3DDevice9_UpdateSurface" ( _
    BYVAL pthis AS DWORD PTR, BYVAL pSourceSurface AS DWORD, BYREF pSourceRect AS RECT, _
    BYVAL pDestinationSurface AS DWORD, BYREF pDestinationPoint AS POINTAPI) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[30] USING IDirect3DDevice9_UpdateSurface(pthis, pSourceSurface, pSourceRect, pDestinationSurface, pDestinationPoint) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' UpdateTexture method
' Updates the dirty portions of a texture.
' HRESULT UpdateTexture(
'   IDirect3DBaseTexture9 * pSourceTexture,
'   IDirect3DBaseTexture9 * pDestinationTexture
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_UpdateTexture ALIAS "IDirect3DDevice9_UpdateTexture" ( _
    BYVAL pthis AS DWORD PTR, BYVAL pSourceTexture AS DWORD, _
    BYVAL pDestinationTexture AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[31] USING IDirect3DDevice9_UpdateTexture(pthis, pSourceTexture, pDestinationTexture) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetRenderTargetData method
' Copies the render-target data from device memory to system memory.
' HRESULT GetRenderTargetData(
'   IDirect3DSurface9* pRenderTarget,
'   IDirect3DSurface9* pDestSurface
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetRenderTargetData ALIAS "IDirect3DDevice9_GetRenderTargetData" ( _
    BYVAL pthis AS DWORD PTR, BYVAL pRenderTarget AS DWORD, BYVAL pDestSurface AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[32] USING IDirect3DDevice9_GetRenderTargetData(pthis, pRenderTarget, pDestSurface) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetFrontBufferData method
' Generates a copy of the device's front buffer and places that copy in a system memory
' buffer provided by the application.
' HRESULT GetFrontBufferData(
'   UINT  iSwapChain,
'   IDirect3DSurface9 * pDestSurface
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetFrontBufferData ALIAS "IDirect3DDevice9_GetFrontBufferData" ( _
    BYVAL pthis AS DWORD PTR, BYVAL iSwapChain AS DWORD, BYVAL pDestSurface AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[33] USING IDirect3DDevice9_GetFrontBufferData(pthis, iSwapChain, pDestSurface) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' StretchRect method
' Copy the contents of the source rectangle to the destination rectangle. The source
' rectangle can be stretched and filtered by the copy. This function is often used to
' change the aspect ratio of a video stream.
' HRESULT StretchRect(
'   IDirect3DSurface9 * pSourceSurface,
'   CONST RECT * pSourceRect,
'   IDirect3DSurface9 * pDestSurface,
'   CONST RECT * pDestRect,
'   D3DTEXTUREFILTERTYPE Filter
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_StretchRect ALIAS "IDirect3DDevice9_StretchRect" ( _
    BYVAL pthis AS DWORD PTR, BYVAL pSourceSurface AS DWORD, _
    BYREF pSourceRect AS RECT, BYVAL pDestSurface AS DWORD, _
    BYREF pDestRect AS RECT, BYVAL Filter AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[34] USING IDirect3DDevice9_StretchRect(pthis, pSourceSurface, pSourceRect, pDestSurface, pDestRect, Filter) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' ColorFill method
' Allows an application to fill a rectangular area of a D3DPOOL_DEFAULT surface with a
' specified color.
' HRESULT ColorFill(
'   IDirect3DSurface9 * pSurface,
'   CONST RECT * pRect,
'   D3DCOLOR color
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_ColorFill ALIAS "IDirect3DDevice9_ColorFill" ( _
    BYVAL pthis AS DWORD PTR, BYVAL pSurface AS DWORD, BYREF pRect AS RECT, _
    BYVAL prmColor AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[35] USING IDirect3DDevice9_ColorFill(pthis, pSurface, pRect, prmColor) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' CreateOffscreenPlainSurface method
' Create an off-screen surface.
' HRESULT CreateOffscreenPlainSurface(
'   UINT Width,
'   UINT Height,
'   D3DFORMAT Format,
'   DWORD Pool,
'   IDirect3DSurface9** ppSurface,
'   HANDLE* pSharedHandle
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_CreateOffscreenPlainSurface ALIAS "IDirect3DDevice9_CreateOffscreenPlainSurface" ( _
    BYVAL pthis AS DWORD PTR, BYVAL prmWidth AS DWORD, BYVAL Height AS DWORD, _
    BYVAL prmFormat AS DWORD, BYVAL Pool AS DWORD, BYREF ppSurface AS DWORD, _
    BYVAL pSharedHandle AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[36] USING IDirect3DDevice9_CreateOffscreenPlainSurface(pthis, prmWidth, Height, prmFormat, Pool, ppSurface, pSharedHandle) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetRenderTarget method
' Sets a new color buffer for the device.
' HRESULT SetRenderTarget(
'   DWORD RenderTargetIndex,
'   IDirect3DSurface9 *pRenderTarget
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_SetRenderTarget ALIAS "IDirect3DDevice9_SetRenderTarget" ( _
    BYVAL pthis AS DWORD PTR, BYVAL RenderTargetIndex AS DWORD, BYVAL pRenderTarget AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[37] USING IDirect3DDevice9_SetRenderTarget(pthis, RenderTargetIndex, pRenderTarget) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetRenderTarget method
' Retrieves a render-target surface.
' HRESULT GetRenderTarget(
'   DWORD RenderTargetIndex,
'   IDirect3DSurface9 ** ppRenderTarget
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetRenderTarget ALIAS "IDirect3DDevice9_GetRenderTarget" ( _
    BYVAL pthis AS DWORD PTR, BYVAL RenderTargetIndex AS DWORD, _
    BYREF ppRenderTarget AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[38] USING IDirect3DDevice9_GetRenderTarget(pthis, RenderTargetIndex, ppRenderTarget) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetDepthStencilSurface method
' Sets the depth-stencil surface owned by the Direct3DDevice object.
' HRESULT SetDepthStencilSurface(
'   IDirect3DSurface9 * pNewZStencil
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_SetDepthStencilSurface ALIAS "IDirect3DDevice9_SetDepthStencilSurface" ( _
    BYVAL pthis AS DWORD PTR, BYVAL pNewZStencil AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[39] USING IDirect3DDevice9_SetDepthStencilSurface(pthis, pNewZStencil) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetDepthStencilSurface method
' Gets the depth-stencil surface owned by the Direct3DDevice object.
' HRESULT GetDepthStencilSurface(
'   IDirect3DSurface9 ** ppZStencilSurface
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetDepthStencilSurface ALIAS "IDirect3DDevice9_GetDepthStencilSurface" ( _
    BYVAL pthis AS DWORD PTR, BYREF ppNewZStencil AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[40] USING IDirect3DDevice9_GetDepthStencilSurface(pthis, ppNewZStencil) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' BeginScene method
' Begins a scene.
' HRESULT BeginScene();
' ****************************************************************************************
FUNCTION IDirect3DDevice9_BeginScene ALIAS "IDirect3DDevice9_BeginScene" (BYVAL pthis AS DWORD PTR) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[41] USING IDirect3DDevice9_BeginScene(pthis) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' EndScene method
' Ends a scene that was begun by calling IDirect3DDevice9::BeginScene.
' HRESULT EndScene();
' ****************************************************************************************
FUNCTION IDirect3DDevice9_EndScene ALIAS "IDirect3DDevice9_EndScene" (BYVAL pthis AS DWORD PTR) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[42] USING IDirect3DDevice9_EndScene(pthis) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' Clear method
' Clears one or more surfaces such as a render target, multiple render targets, a stencil
' buffer, and a depth buffer.
' HRESULT Clear(
'   DWORD Count,
'   CONST D3DRECT * pRects,
'   DWORD Flags,
'   D3DCOLOR Color,
'   float Z,
'   DWORD Stencil
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_Clear ALIAS "IDirect3DDevice9_Clear" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Count AS DWORD, BYVAL pRects AS DWORD, _
    BYVAL Flags AS DWORD, BYVAL prmColor AS DWORD, BYVAL Z AS SINGLE, _
    BYVAL Stencil AS LONG) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[43] USING IDirect3DDevice9_Clear(pthis, Count, pRects, Flags, prmColor, z, Stencil) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetTransform method
' Sets a single device transformation-related state.
' HRESULT SetTransform(
'   D3DTRANSFORMSTATETYPE State,
'   CONST D3DMATRIX * pMatrix
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_SetTransform ALIAS "IDirect3DDevice9_SetTransform" ( _
    BYVAL pthis AS DWORD PTR, BYVAL prmState AS DWORD, BYREF pMatrix AS D3DMATRIX) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[44] USING IDirect3DDevice9_SetTransform(pthis, prmState, pMatrix) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetTransform method
' Retrieves a matrix describing a transformation state.
' HRESULT GetTransform(
'   D3DTRANSFORMSTATETYPE State,
'   D3DMATRIX * pMatrix
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetTransform ALIAS "IDirect3DDevice9_GetTransform" ( _
    BYVAL pthis AS DWORD PTR, BYVAL prmState AS DWORD, BYREF pMatrix AS D3DMATRIX) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[45] USING IDirect3DDevice9_GetTransform(pthis, prmState, pMatrix) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' MultiplyTransform method
' Multiplies a device's world, view, or projection matrices by a specified matrix.
' HRESULT MultiplyTransform(
'   D3DTRANSFORMSTATETYPE State,
'   CONST D3DMATRIX * pMatrix
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_MultiplyTransform ALIAS "IDirect3DDevice9_MultiplyTransform" ( _
    BYVAL pthis AS DWORD PTR, BYVAL prmState AS DWORD, BYREF pMatrix AS D3DMATRIX) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[46] USING IDirect3DDevice9_MultiplyTransform(pthis, prmState, pMatrix) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetViewport method
' Sets the viewport parameters for the device.
' HRESULT SetViewport(
'   CONST D3DVIEWPORT9 * pViewport
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_SetViewport ALIAS "IDirect3DDevice9_SetViewport" ( _
    BYVAL pthis AS DWORD PTR, BYREF pViewport AS D3DVIEWPORT9) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[47] USING IDirect3DDevice9_SetViewport(pthis, pViewport) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetViewport method
' Retrieves the viewport parameters currently set for the device.
' HRESULT GetViewport(
'   D3DVIEWPORT9 * pViewport
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetViewport ALIAS "IDirect3DDevice9_GetViewport" ( _
    BYVAL pthis AS DWORD PTR, BYREF pViewport AS D3DVIEWPORT9) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[48] USING IDirect3DDevice9_GetViewport(pthis, pViewport) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetMaterial method
' Sets the material properties for the device.
' HRESULT SetMaterial(
'   CONST D3DMATERIAL9 * pMaterial
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_SetMaterial ALIAS "IDirect3DDevice9_SetMaterial" ( _
    BYVAL pthis AS DWORD PTR, BYREF pMaterial AS D3DMATERIAL9) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[49] USING IDirect3DDevice9_SetMaterial(pthis, pMaterial) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetMaterial method
' Retrieves the current material properties for the device.
' HRESULT GetMaterial(
'   D3DMATERIAL9 * pMaterial
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetMaterial ALIAS "IDirect3DDevice9_GetMaterial" ( _
    BYVAL pthis AS DWORD PTR, BYREF pMaterial AS D3DMATERIAL9) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[50] USING IDirect3DDevice9_GetMaterial(pthis, pMaterial) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetLight method
' Assigns a set of lighting properties for this device.
' HRESULT SetLight(
'   DWORD Index,
'   CONST D3DLight9 * pLight
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_SetLight ALIAS "IDirect3DDevice9_SetLight" ( _
    BYVAL pthis AS DWORD PTR, BYVAL index AS DWORD, BYREF pLight AS D3DLIGHT9) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[51] USING IDirect3DDevice9_SetLight(pthis, index, pLight) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetLight method
' Retrieves a set of lighting properties that this device uses.
' HRESULT GetLight(
'   DWORD Index,
'   D3DLight9 * pLight
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetLight ALIAS "IDirect3DDevice9_GetLight" ( _
    BYVAL pthis AS DWORD PTR, BYVAL index AS DWORD, BYREF pLight AS D3DLIGHT9) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[52] USING IDirect3DDevice9_GetLight(pthis, index, pLight) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' LightEnable method
' Enables or disables a set of lighting parameters within a device.
' HRESULT LightEnable(
'   DWORD LightIndex,
'   BOOL bEnable
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_LightEnable ALIAS "IDirect3DDevice9_LightEnable" ( _
    BYVAL pthis AS DWORD PTR, BYVAL LightIndex AS DWORD, BYVAL bEnable AS LONG) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[53] USING IDirect3DDevice9_LightEnable(pthis, LightIndex, bEnable) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetLightEnable method
' Retrieves the activity status--enabled or disabled--for a set of lighting parameters
' within a device.
' HRESULT GetLightEnable(
'   DWORD Index,
'   BOOL * pEnable
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetLightEnable ALIAS "IDirect3DDevice9_GetLightEnable" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Index AS DWORD, BYREF pEnable AS LONG) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[54] USING IDirect3DDevice9_GetLightEnable(pthis, Index, pEnable) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetClipPlane method
' Sets the coefficients of a user-defined clipping plane for the device.
' HRESULT SetClipPlane(
'   DWORD Index,
'   CONST float * pPlane
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_SetClipPlane ALIAS "IDirect3DDevice9_SetClipPlane" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Index AS LONG, BYVAL pPlane AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[55] USING IDirect3DDevice9_SetClipPlane(pthis, Index, pPlane) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetClipPlane method
' Retrieves the coefficients of a user-defined clipping plane for the device.
' HRESULT GetClipPlane(
'   DWORD Index,
'   float * pPlane
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetClipPlane ALIAS "IDirect3DDevice9_GetClipPlane" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Index AS LONG, BYVAL pPlane AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[56] USING IDirect3DDevice9_GetClipPlane(pthis, Index, pPlane) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetRenderState method
' Sets a single device render-state parameter.
' HRESULT SetRenderState(
'   D3DRENDERSTATETYPE State,
'   DWORD Value
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_SetRenderState ALIAS "IDirect3DDevice9_SetRenderState" ( _
    BYVAL pthis AS DWORD PTR, BYVAL StateType AS DWORD, BYVAL Value AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[57] USING IDirect3DDevice9_SetRenderState(pthis, StateType, Value) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetRenderState method
' Retrieves a render-state value for a device.
' HRESULT GetRenderState(
'   D3DRENDERSTATETYPE State,
'   DWORD * pValue
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetRenderState ALIAS "IDirect3DDevice9_GetRenderState" ( _
    BYVAL pthis AS DWORD PTR, BYVAL StateType AS DWORD, BYREF pValue AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[58] USING IDirect3DDevice9_GetRenderState(pthis, StateType, pValue) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' CreateStateBlock method
' Creates a new state block that contains the values for all device states, vertex-related
' states, or pixel-related states.
' HRESULT CreateStateBlock(
'   D3DSTATEBLOCKTYPE Type,
'   IDirect3DStateBlock9** ppSB
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_CreateStateBlock ALIAS "IDirect3DDevice9_CreateStateBlock" ( _
    BYVAL pthis AS DWORD PTR, BYVAL StateType AS DWORD, BYREF ppSB AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[59] USING IDirect3DDevice9_CreateStateBlock(pthis, StateType, ppSB) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' BeginStateBlock method
' Signals Microsoft Direct3D to begin recording a device-state block.
' HRESULT BeginStateBlock();
' ****************************************************************************************
FUNCTION IDirect3DDevice9_BeginStateBlock ALIAS "IDirect3DDevice9_BeginStateBlock" (BYVAL pthis AS DWORD PTR) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[60] USING IDirect3DDevice9_BeginStateBlock(pthis) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' EndStateBlock method
' Signals Microsoft Direct3D to stop recording a device-state block and retrieve a pointer to
' the state block interface.
' HRESULT EndStateBlock(
'   IDirect3DStateBlock9 ** ppSB
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_EndStateBlock ALIAS "IDirect3DDevice9_EndStateBlock" ( _
    BYVAL pthis AS DWORD PTR, BYREF ppSB AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[61] USING IDirect3DDevice9_EndStateBlock(pthis, ppSB) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetClipStatus method
' Sets the clip status.
' HRESULT SetClipStatus(
'   CONST D3DCLIPSTATUS9 * pClipStatus
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_SetClipStatus ALIAS "IDirect3DDevice9_SetClipStatus" ( _
    BYVAL pthis AS DWORD PTR, BYREF pClipStatus AS D3DCLIPSTATUS9) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[62] USING IDirect3DDevice9_SetClipStatus(pthis, pClipStatus) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetClipStatus method
' Gets the clip status.
' HRESULT GetClipStatus(
'   D3DCLIPSTATUS9 * pClipStatus
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetClipStatus ALIAS "IDirect3DDevice9_GetClipStatus" ( _
    BYVAL pthis AS DWORD PTR, BYREF pClipStatus AS D3DCLIPSTATUS9) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[63] USING IDirect3DDevice9_GetClipStatus(pthis, pClipStatus) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetTexture method
' Retrieves a texture assigned to a stage for a device.
' HRESULT GetTexture(
'   DWORD Stage,
'   IDirect3DBaseTexture9 ** ppTexture
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetTexture ALIAS "IDirect3DDevice9_GetTexture" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Stage AS DWORD, BYREF ppTexture AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[64] USING IDirect3DDevice9_GetTexture(pthis, Stage, ppTexture) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetTexture method
' Assigns a texture to a stage for a device.
' HRESULT SetTexture(
'   DWORD Sampler,
'   IDirect3DBaseTexture9 * pTexture
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_SetTexture ALIAS "IDirect3DDevice9_SetTexture" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Sampler AS DWORD, BYVAL pTexture AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[65] USING IDirect3DDevice9_SetTexture(pthis, Sampler, pTexture) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetTextureStageState method
' Retrieves a state value for an assigned texture.
' HRESULT GetTextureStageState(
'   DWORD Stage,
'   D3DTEXTURESTAGESTATETYPE Type,
'   DWORD * pValue
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetTextureStageState ALIAS "IDirect3DDevice9_GetTextureStageState" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Stage AS DWORD, BYVAL StateType AS DWORD, _
    BYREF pValue AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[66] USING IDirect3DDevice9_GetTextureStageState(pthis, Stage, StateType, pValue) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetTextureStageState method
' Sets the state value for the currently assigned texture.
' HRESULT SetTextureStageState(
'   DWORD Stage,
'   D3DTEXTURESTAGESTATETYPE Type,
'   DWORD Value
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_SetTextureStageState ALIAS "IDirect3DDevice9_SetTextureStageState" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Stage AS DWORD, BYVAL StateType AS DWORD, _
    BYVAL pValue AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[67] USING IDirect3DDevice9_SetTextureStageState(pthis, Stage, StateType, pValue) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetSamplerState method
' Gets the sampler state value.
' HRESULT GetSamplerState(
'   DWORD Sampler,
'   D3DSAMPLERSTATETYPE Type,
'   DWORD* pValue
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetSamplerState ALIAS "IDirect3DDevice9_GetSamplerState" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Sampler AS DWORD, BYVAL StateType AS DWORD, _
    BYREF pValue AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[68] USING IDirect3DDevice9_GetSamplerState(pthis, Sampler, StateType, pValue) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetSamplerState method
' Sets the sampler state value.
' HRESULT SetSamplerState(
'   DWORD Sampler,
'   D3DSAMPLERSTATETYPE Type,
'   DWORD Value
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_SetSamplerState ALIAS "IDirect3DDevice9_SetSamplerState" ( _
    BYVAL pthis AS DWORD PTR, BYVAL Sampler AS DWORD, BYVAL StateType AS DWORD, _
    BYVAL pValue AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[69] USING IDirect3DDevice9_SetSamplerState(pthis, Sampler, StateType, pValue) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' ValidateDevice method
' Reports the device's ability to render the current texture-blending operations and
' arguments in a single pass.
' HRESULT ValidateDevice(
'   DWORD * pNumPasses
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_ValidateDevice ALIAS "IDirect3DDevice9_ValidateDevice" ( _
    BYVAL pthis AS DWORD PTR, BYREF pNumPasses AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[70] USING IDirect3DDevice9_ValidateDevice(pthis, pNumPasses) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetPaletteEntries method
' Sets palette entries.
' Note  As of Microsoft DirectX 9.0, the peFlags member of the PALETTEENTRY structure does
' not work the way it is documented in the Platform SDK. The peFlags member is now the
' alpha channel for 8-bit palletized formats.
' HRESULT SetPaletteEntries(
'   UINT PaletteNumber,
'   CONST PALETTEENTRY * pEntries
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_SetPaletteEntries ALIAS "IDirect3DDevice9_SetPaletteEntries" ( _
    BYVAL pthis AS DWORD PTR, BYVAL PaletteNumber AS DWORD, BYVAL pEntries AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[71] USING IDirect3DDevice9_SetPaletteEntries(pthis, PaletteNumber, pEntries) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetPaletteEntries method
' Gets palette entries.
' Note  As of Microsoft DirectX 9.0, the peFlags member of the PALETTEENTRY structure does
' not work the way it is documented in the Platform SDK. The peFlags member is now the
' alpha channel for 8-bit palletized formats.
' HRESULT GetPaletteEntries(
'   UINT PaletteNumber,
'   PALETTEENTRY * pEntries
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetPaletteEntries ALIAS "IDirect3DDevice9_GetPaletteEntries" ( _
    BYVAL pthis AS DWORD PTR, BYVAL PaletteNumber AS DWORD, BYVAL pEntries AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[72] USING IDirect3DDevice9_GetPaletteEntries(pthis, PaletteNumber, pEntries) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetCurrentTexturePalette method
' Sets the current texture palette
' HRESULT SetCurrentTexturePalette(
'   UINT PaletteNumber
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_SetCurrentTexturePalette ALIAS "IDirect3DDevice9_SetCurrentTexturePalette" ( _
    BYVAL pthis AS DWORD PTR, BYVAL PaletteNumber AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[73] USING IDirect3DDevice9_SetCurrentTexturePalette(pthis, PaletteNumber) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' GetCurrentTexturePalette method
' Gets the current texture palette
' HRESULT GetCurrentTexturePalette(
'   UINT * pPaletteNumber
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_GetCurrentTexturePalette ALIAS "IDirect3DDevice9_GetCurrentTexturePalette" ( _
    BYVAL pthis AS DWORD PTR, BYREF PaletteNumber AS DWORD) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[74] USING IDirect3DDevice9_GetCurrentTexturePalette(pthis, PaletteNumber) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' ****************************************************************************************

' ****************************************************************************************
' SetScissorRect method
' Sets the scissor rectangle.
' HRESULT SetScissorRect(
'   CONST RECT * pRect
' );
' ****************************************************************************************
FUNCTION IDirect3DDevice9_SetScissorRect ALIAS "IDirect3DDevice9_SetScissorRect" ( _
    BYVAL pthis AS DWORD PTR, BYREF pRect AS RECT) EXPORT AS LONG

    LOCAL HRESULT AS LONG
    IF pthis = %NULL THEN FUNCTION = %E_POINTER : EXIT FUNCTION
    CALL DWORD @@pthis[75] USING IDirect3DDevice9_SetScissorRect(pthis, pRect) TO HRESULT
    FUNCTION = HRESULT

END FUNCTION
' **************************************************************************