Guidance
指路人
g.yi.org
software / rapidq / Examples / Game / directx & direct3d / DirectX Dev / DDRAW_003.INC

Register 
注册
Search 搜索
首页 
Home Home
Software
Upload

  
' RapidQ COM utility to call function by either address or by pointer
' code kindly contributed by Jacques Philippe, July 05nd, 2004
'
     $INCLUDE "RqAsmUtils.Inc"   ' The Same as the Dll AsmUtils.dll ... maybe with error exception on CallAddress/Pointer
'
'function list:
'Function CallAddressManyArgs (address As Long, ptrStructArg As Long) As Long	'call if you have absolute address
'Function CallPointerManyArgs (pointer As Long, ptrStructArg As Long) As Long	'call if you have poiner to addres (COM)
' how to use:
'   DIM myArray(0 TO n)		'holds the arguments
'   lpArray = VarPtr(myArray(0))
'   lpSUB = CODEPTR(SUB or FUNCTION)
'      COM provides you an address that points to the first member of the interface (i.e., it is a pointer)
'      then the address + 4 points to the second member of the interface, and so on. You must set up the header
'      so that the right number and types of parameters are called to the interface member
'   myArray(0) = n               ' n =  arguments to pass
'   myArray(1) = xxx             ' Argument 1
'   myArray(2) = yyy             ' Argument 2
'   .......
'   myArray(n) = nnn             ' Argument n
'     then call it
'   CallPointerManyArgs(VarPtr(lpSUB), lpArray)                     'for rapidq SUB / FUNCTION
'   CallPointerManyArgs(lpSUB + member_offset, lpArray)             'for COM calling
'
'
'------------------------------------------------------------------------------
'
' INCLUE FILE DDRAW.INC for DirectDraw development in RapidQ
' modeled after PB_DDRAW.INC by Vladimir Shulakov
' (inital release May 12, 2003). by E-Mail:       overloc@uch.net
'
'------------------------------------------------------------------------------
'
'
' Now a message from the kingdom of M$
' *==========================================================================;
' *
' *  Copyright (C) Microsoft Corporation.  All Rights Reserved.
' *
' *  File:       ddraw.h
' *  Content:    DirectDraw include file
' *
' ***************************************************************************)
' *  DirectX header for RapidQ, modified from DirectX.pas by  Hiroyuki Hori.
' *  E-Mail: hori@ingjapan.ne.jp
' *  Homepage: http://www.ingjapan.ne.jp/hori/index.html
' *  Homepage: http://www.ingjapan.ne.jp/hori/index-e.html
' *  Components derived from
' *    DirectX.pas    DirectX 7 (DirectX 7 SDK)
' *    DShow.pas      DirectShow (DirectX Media SDK 5.1)
' *    DAnim.pas      DirectAnimation (DirectX Media SDK 5.1)
' *
' *--------------------------------------------------------------------------




     DECLARE FUNCTION DirectDrawCreate        LIB "DDRAW.DLL" ALIAS "DirectDrawCreate"(lpGUID AS LONG, BYREF lplpDD AS LONG, pUnkOuter AS LONG) AS LONG
  'lpGUID- Address of new driver GUID to be create use NULL for active display driver
  'lplpDD- Address of a pointer that will be initialized with a valid DirectDraw pointer
  'pUnkOuter - MS future hack, always send NULL
     DECLARE FUNCTION DirectDrawCreateClipper LIB "DDRAW.DLL" ALIAS "DirectDrawCreateClipper"(dwFlags AS DWORD, BYREF lplpDDClipper AS LONG, pUnkOuter AS LONG) AS LONG
  'dwFlags- must be set to 0
  'lplpDDClipper- Address of a pointer to be filled in with the address of the new DirectDrawClipper object.
  'pUnkOuter - MS future hack, always send NULL

     DECLARE FUNCTION DirectDrawCreateEx      LIB "DDRAW.DLL" ALIAS "DirectDrawCreateEx"(BYREF lpGUID AS LONG, BYREF lplpDD AS LONG, iid AS LONG, pUnkOuter AS LONG) AS LONG
  'Allow for latest D3D from IDirect3D7
  'lpGUID- Address of the GUID driver to be created, or use NULL for active display driver
  'or can be either flag for debugging purposes:
  'DDCREATE_EMULATIONONLY - software emulate all features or DDCREATE_HARDWAREONLY only in hardware
  'lplpDD- Address of a variable to be set to a valid IDirectDraw7 interface pointer
  'iid- must be set to IID_IDirectDraw7
  'pUnkOuter - MS future hack, always send NULL

     DECLARE FUNCTION DirectDrawEnumerate     LIB "DDRAW.DLL" ALIAS "DirectDrawEnumerateA"   (lpCallback AS DWORD,BYVAL lpContext AS DWORD) AS LONG
     DECLARE FUNCTION DirectDrawEnumerateW    LIB "DDRAW.DLL" ALIAS "DirectDrawEnumerateW"   (lpCallback AS DWORD,BYVAL lpContext AS DWORD) AS LONG
     DECLARE FUNCTION DirectDrawEnumerateEx   LIB "DDRAW.DLL" ALIAS "DirectDrawEnumerateExA" (lpCallback AS DWORD,BYVAL lpContext AS DWORD,BYVAL dwFlags AS DWORD) AS LONG
'function DirectDrawEnumerateExA(lpCallback: DDEnumCallbackExA; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
'function DirectDrawEnumerateExW(lpCallback: DDEnumCallbackExW; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;
'function DirectDrawEnumerateEx(lpCallback: DDEnumCallbackExA; lpContext: Pointer; dwFlags: DWORD): HResult; stdcall;


     DECLARE FUNCTION Direct3DRMCreate LIB "d3drm.dll" ALIAS "Direct3DRMCreate" (ByRef lplpDirect3DRM AS LONG) AS LONG
     DECLARE FUNCTION  CLSIDFromString LIB "ole32.dll" ALIAS "CLSIDFromString" (BYVAL lpszProgID AS LONG, pCLSID AS LONG) AS LONG
'ex, CLSIDFromString StrPtr("{1D5BE4B5-FA4A-452D-9CDD-5DB3505E7EB}"), .GUID

'IDirectDraw * (pointer) = LPDIRECTDRAW are equivalent
'IDirectDrawSurface * (pointer) = LPDIRECTDRAWSURFACE
'This is a Microsoft COM convention used throughout DirectX

     $DEFINE DirectX7 1
     $DEFINE LPDIRECTDRAW			LONG
     $DEFINE LPDIRECTDRAWSURFACE		LONG
     $DEFINE IDirectDraw				LPDIRECTDRAW			'really a LONG holding a pointer
     $DEFINE IDirectDrawSurface		LPDIRECTDRAWSURFACE		'really a LONG holding a pointer
     $DEFINE HRESULT					LONG


' FOURCC codes for DX compressed-texture pixel formats
     CONST  FOURCC_DXT1 = ASC("D") + ASC("X") SHL 8 + ASC("T") SHL 16 + ASC("1") SHL 24
     CONST  FOURCC_DXT2 = ASC("D") + ASC("X") SHL 8 + ASC("T") SHL 16 + ASC("2") SHL 24
     CONST  FOURCC_DXT3 = ASC("D") + ASC("X") SHL 8 + ASC("T") SHL 16 + ASC("3") SHL 24
     CONST  FOURCC_DXT4 = ASC("D") + ASC("X") SHL 8 + ASC("T") SHL 16 + ASC("4") SHL 24
     CONST  FOURCC_DXT5 = ASC("D") + ASC("X") SHL 8 + ASC("T") SHL 16 + ASC("5") SHL 24


'GUIDS used by DirectDraw objects
'$DEFINE GUID AS STRING * 16

     TYPE GUID
      Data1		AS LONG
      Data2		AS SHORT
      Data3		AS SHORT
      Data4(7)	AS BYTE 		'unsigned char Data4[8];
     END TYPE

     DIM IID_IDirectDraw             AS STRING * 16
     DIM IID_IDirectDraw2            AS STRING * 16
     DIM IID_IDirectDraw3            AS STRING * 16
     DIM IID_IDirectDraw4            AS STRING * 16
     DIM IID_IDirectDrawSurface      AS STRING * 16
     DIM IID_IDirectDrawSurface2     AS STRING * 16
     DIM IID_IDirectDrawSurface3     AS STRING * 16
     DIM IID_IDirectDrawSurface4     AS STRING * 16
     DIM IID_IDirectDrawPalette      AS STRING * 16
     DIM IID_IDirectDrawClipper      AS STRING * 16
     DIM IID_IDirectDrawColorControl AS STRING * 16
     DIM IID_IDirectDrawGammaControl AS STRING * 16

'these need to be checked!!! usually you won't need them except colorcontrol and gammaramp
     IID_IDirectDraw             = CHR$(&H80)+CHR$(&HDB)+CHR$(&H14)+CHR$(&H6C)+ CHR$(&H33)+CHR$(&HA7) +CHR$(&HCE)+CHR$(&H11)+CHR$( &HA5)+CHR$(&H21)+CHR$( &H00)+CHR$(&H20)+CHR$(&HAF)+CHR$(&H0B)+CHR$(&HE5)+CHR$(&H60)
     IID_IDirectDraw2            = CHR$(&HE0)+CHR$(&HF3)+CHR$(&HA6)+CHR$(&HB3)+ CHR$(&H43)+CHR$(&H2B) +CHR$(&HCF)+CHR$(&H11)+CHR$( &HA2)+CHR$(&HDE)+CHR$( &H00)+CHR$(&HAA)+CHR$(&H00)+CHR$(&HB9)+CHR$(&H33)+CHR$(&H56)
     IID_IDirectDraw3            = CHR$(&HD4)+CHR$(&H8A)+CHR$(&H8F)+CHR$(&H61)+ CHR$(&H7A)+CHR$(&H8b) +CHR$(&HD0)+CHR$(&H11)+CHR$( &H8F)+CHR$(&HCC)+CHR$( &H00)+CHR$(&Hc0)+CHR$(&H4f)+CHR$(&Hd9)+CHR$(&H18)+CHR$(&H9d)
     IID_IDirectDraw4            = CHR$(&H9A)+CHR$(&H50)+CHR$(&H59)+CHR$(&H9c)+ CHR$(&HBD)+CHR$(&H39) +CHR$(&HD1)+CHR$(&H11)+CHR$( &H8C)+CHR$(&H4A)+CHR$( &H00)+CHR$(&Hc0)+CHR$(&H4f)+CHR$(&Hd9)+CHR$(&H30)+CHR$(&Hc5)
     IID_IDirectDraw7            = CHR$(&HC0)+CHR$(&H5E)+CHR$(&HE6)+CHR$(&H15)+ CHR$(&H9C)+CHR$(&H3B) +CHR$(&HD2)+CHR$(&H11)+CHR$( &HB9)+CHR$(&H2F)+CHR$( &H00)+CHR$(&H60)+CHR$(&H97)+CHR$(&H97)+CHR$(&HEA)+CHR$(&H5B)

     IID_IDirectDrawSurface      = CHR$(&H81)+CHR$(&HDB)+CHR$(&H14)+CHR$(&H6C)+CHR$( &H33)+CHR$(&HA7)+CHR$( &HCE)+CHR$(&H11)+CHR$( &HA5)+CHR$(&H21)+CHR$( &H00)+CHR$(&H20)+CHR$(&HAF)+CHR$(&H0B)+CHR$(&HE5)+CHR$(&H60)
     IID_IDirectDrawSurface2     = CHR$(&H85)+CHR$(&H58)+CHR$(&H80)+CHR$(&H57)+CHR$( &HEC)+CHR$(&H6E)+CHR$( &HCF)+CHR$(&H11)+CHR$( &H94)+CHR$(&H41)+CHR$( &HA8)+CHR$(&H23)+CHR$(&H03)+CHR$(&HC1)+CHR$(&H0E)+CHR$(&H27)
     IID_IDirectDrawSurface3     = CHR$(&H00)+CHR$(&H4E)+CHR$(&H04)+CHR$(&HDA)+CHR$( &HB2)+CHR$(&H69)+CHR$( &HD0)+CHR$(&H11)+CHR$( &HA1)+CHR$(&HD5)+CHR$( &H00)+CHR$(&HAA)+CHR$(&H00)+CHR$(&HB8)+CHR$(&HDF)+CHR$(&HBB)
     IID_IDirectDrawSurface4     = CHR$(&H30)+CHR$(&H86)+CHR$(&H2B)+CHR$(&H0B)+CHR$( &H35)+CHR$(&HAD)+CHR$( &HD0)+CHR$(&H11)+CHR$( &HA6)+CHR$(&H8E)+CHR$( &H00)+CHR$(&H60)+CHR$(&H97)+CHR$(&H97)+CHR$(&HEA)+CHR$(&H5B)
     IID_IDirectDrawSurface7     = CHR$(&H80)+CHR$(&H5A)+CHR$(&H67)+CHR$(&H06)+CHR$( &H9B)+CHR$(&H3B)+CHR$( &HD2)+CHR$(&H11)+CHR$( &H2F)+CHR$(&HB9)+CHR$( &H00)+CHR$(&H60)+CHR$(&H97)+CHR$(&H97)+CHR$(&HEA)+CHR$(&H5B)
     IID_IDirectDrawPalette      = CHR$(&H84)+CHR$(&HDB)+CHR$(&H14)+CHR$(&H6C)+CHR$( &H33)+CHR$(&HA7)+CHR$( &HCE)+CHR$(&H11)+CHR$( &HA5)+CHR$(&H21)+CHR$( &H00)+CHR$(&H20)+CHR$(&HAF)+CHR$(&H0B)+CHR$(&HE5)+CHR$(&H60)
     IID_IDirectDrawClipper      = CHR$(&H85)+CHR$(&HDB)+CHR$(&H14)+CHR$(&H6C)+CHR$( &H33)+CHR$(&HA7)+CHR$( &HCE)+CHR$(&H11)+CHR$( &HA5)+CHR$(&H21)+CHR$( &H00)+CHR$(&H20)+CHR$(&HAF)+CHR$(&H0B)+CHR$(&HE5)+CHR$(&H60)
     IID_IDirectDrawColorControl = CHR$(&HE0)+CHR$(&H0E)+CHR$(&H9F)+CHR$(&H4B)+CHR$( &H7E)+CHR$(&H0D)+CHR$( &HD0)+CHR$(&H11)+CHR$( &H9B)+CHR$(&H06)+CHR$( &H00)+CHR$(&HA0)+CHR$(&HC9)+CHR$(&H03)+CHR$(&HA3)+CHR$(&HB8)
     IID_IDirectDrawGammaControl = CHR$(&H3E)+CHR$(&H1C)+CHR$(&HC1)+CHR$(&H69)+CHR$( &H6B)+CHR$(&HB4)+CHR$( &HD1)+CHR$(&H11)+CHR$( &H7A)+CHR$(&HAD)+CHR$( &H00)+CHR$(&HC0)+CHR$(&H4F)+CHR$(&HC2)+CHR$(&H9B)+CHR$(&H4E)
'orignal for reference
'  IID_IDirectDraw: TGUID = '{6C14DB80-A733-11CE-A521-0020AF0BE560}';
'  IID_IDirectDraw2: TGUID = '{B3A6F3E0-2B43-11CF-A2DE-00AA00B93356}';
'  IID_IDirectDraw4: TGUID = '{9C59509A-39BD-11D1-8C4A-00C04FD930C5}';
'  IID_IDirectDraw7: TGUID = '{15E65EC0-3B9C-11D2-B92F-00609797EA5B}';
'  IID_IDirectDrawSurface: TGUID = '{6C14DB81-A733-11CE-A521-0020AF0BE560}';
'  IID_IDirectDrawSurface2: TGUID = '{57805885-6EEC-11CF-9441-A82303C10E27}';
'  IID_IDirectDrawSurface3: TGUID = '{DA044E00-69B2-11D0-A1D5-00AA00B8DFBB}';
'  IID_IDirectDrawSurface4: TGUID = '{0B2B8630-AD35-11D0-8EA6-00609797EA5B}';
'  IID_IDirectDrawSurface7: TGUID = '{06675A80-3B9B-11D2-B92F-00609797EA5B}';
'  IID_IDirectDrawPalette: TGUID = '{6C14DB84-A733-11CE-A521-0020AF0BE560}';
'  IID_IDirectDrawClipper: TGUID = '{6C14DB85-A733-11CE-A521-0020AF0BE560}';
'  IID_IDirectDrawColorControl: TGUID = '{4B9F0EE0-0D7E-11D0-9B06-00A0C903A3B8}';
'  IID_IDirectDrawGammaControl: TGUID = '{69C11C3E-B46B-11D1-AD7A-00C04FC29B4E}';

'CLSID - use in CoCreateInstance when you want to create only one object on the local system
'   to create multiple objects based on a single CLSID, use the CoGetClassObject function.
'DIM CLSID_DirectDraw            AS STRING * 16
'DIM CLSID_DirectDrawClipper     AS STRING * 16
'DIM CLSID_DirectDrawFactory     AS STRING * 16
'CLSID_DirectDraw: TGUID = '{D7B70EE0-4340-11CF-B063-0020AFC2CD35}'; **notice backwards loading!!!
'CLSID_DirectDraw            = CHR$(&HE0)+CHR$(&H0E)+CHR$(&HB7)+CHR$(&HD7)+CHR$( &H40)+CHR$(&H43)+CHR$( &HCF)+CHR$(&H11)+CHR$( &HB0)+CHR$(&H63)+CHR$( &H00)+CHR$(&H20)+CHR$(&HAF)+CHR$(&HC2)+CHR$(&HCD)+CHR$(&H35)
'CLSID_DirectDrawClipper     = CHR$(&HA0)+CHR$(&H17)+CHR$(&H38)+CHR$(&H59)+CHR$( &HB3)+CHR$(&H7D)+CHR$( &HCF)+CHR$(&H11)+CHR$( &HA2)+CHR$(&HDE)+CHR$( &H00)+CHR$(&HAA)+CHR$(&H00)+CHR$(&HB9)+CHR$(&H33)+CHR$(&H56)
'CLSID_DirectDrawClipper: TGUID = '{593817A0-7DB3-11CF-A2DE-00AA00B93356}';
'CLSID_DirectDrawFactory     = CHR$(&H32)+CHR$(&HA8)+CHR$(&HD2)+CHR$(&H4F)+CHR$( &HC8)+CHR$(&H86)+CHR$( &HD0)+CHR$(&H11)+CHR$( &H8F)+CHR$(&HCA)+CHR$( &H00)+CHR$(&Hc0)+CHR$(&H4f)+CHR$(&Hd9)+CHR$(&H18)+CHR$(&H9d)
'CLSID_DirectDraw7: TGUID = '{3C305196-50DB-11D3-9CFE-00C04FD930C5}';
'DIM DDXInterface     AS STRING *16





     CONST DD_ROP_SPACE               = (256 / 32)'       '' space required to store ROP array
     CONST MAX_DDDEVICEID_STRING      = 512
' Flags for the IDirectDraw4.GetDeviceIdentifier method
     CONST DDGDI_GETHOSTIDENTIFIER    = &h00000001




' ************************************************
' DirectDraw Structures
' ************************************************

     TYPE REFGUID
      guid_or_Flags	AS DWORD
     END TYPE

     TYPE DDRGBA
      red         AS BYTE
      green       AS BYTE
      blue        AS BYTE
      alpha       AS BYTE
     END TYPE

     TYPE DDCOLORKEY
      dwColorSpaceLowValue    AS DWORD// low boundary of COLOR space that IS TO be treated AS COLOR Key, inclusive
      dwColorSpaceHighValue   AS DWORD// high boundary of COLOR space that IS TO be treated AS COLOR Key, inclusive
     END TYPE




'---------------------
     TYPE DDBLTFX
      dwSize                       AS DWORD
      dwDDFX                       AS DWORD
      dwROP                        AS DWORD
      dwDDROP                      AS DWORD
      dwRotationAngle              AS DWORD
      dwZBufferOpCode              AS DWORD
      dwZBufferLow                 AS DWORD
      dwZBufferHigh                AS DWORD
      dwZBufferBaseDest            AS DWORD
      dwZDestConstBitDepth         AS DWORD
      dwZDestConst_or_lpDDSZBufferDest       AS DWORD    'union 1
      dwZSrcConstBitDepth          AS DWORD
      dwZSrcConst_or_lpDDSZBufferSrc         AS DWORD    'union 2
      dwAlphaEdgeBlendBitDepth     AS DWORD
      dwAlphaEdgeBlend             AS DWORD
      dwBltFxReserved              AS DWORD
      dwAlphaDestConstBitDepth     AS DWORD
      dwAlphaDestConst_or_lpDDSAlphaDest     AS DWORD    'union 3
      dwAlphaSrcConstBitDepth      AS DWORD
      dwAlphaSrcConst_or_lpDDSAlphaSrc       AS DWORD    'union 4
      dwFillColor_or_Depth_or_Pixel_or_lpDDSPattern  AS DWORD    'union 5
      ddckDestColorkey_dwColorSpaceLowValue    AS DWORD
      ddckSrcColorkey_dwColorSpaceHighValue	AS DWORD
     END TYPE

     TYPE DDSCAPS
      dwCaps      AS DWORD    'FAR* LPDDSCAPS --ONLY THIS STRUCTURE NOT MODIFIED, ADDING TO MEMBER NAME TAG NAME
     END TYPE

     TYPE DDOSCAPS
      dwCaps      AS DWORD
     END TYPE

     TYPE DDSCAPSEX
      dwCaps2     AS DWORD
      dwCaps3     AS DWORD
      dwCaps4     AS DWORD
     END TYPE



     TYPE DDSCAPS2
      lCaps                 AS LONG
      lCaps2                AS LONG
      lCaps3                AS LONG
      lCaps4                AS LONG
     END TYPE

     TYPE DDCAPS
      dwSize                            AS DWORD ' size of  DDDRIVERCAPS
      dwCaps                            AS DWORD
      dwCaps2                           AS DWORD
      dwCKeyCaps                        AS DWORD
      dwFXCaps                          AS DWORD
      dwFXAlphaCaps                     AS DWORD
      dwPalCaps                         AS DWORD
      dwSVCaps                          AS DWORD
      dwAlphaBltConstBitDepths          AS DWORD ' DDBD_2,4,8
      dwAlphaBltPixelBitDepths          AS DWORD ' DDBD_1,2,4,8
      dwAlphaBltSurfaceBitDepths        AS DWORD ' DDBD_1,2,4,8
      dwAlphaOverlayConstBitDepths      AS DWORD ' DDBD_2,4,8
      dwAlphaOverlayPixelBitDepths      AS DWORD ' DDBD_1,2,4,8
      dwAlphaOverlaySurfaceBitDepths    AS DWORD ' DDBD_1,2,4,8
      dwZBufferBitDepths                AS DWORD ' DDBD_8,16,24,32
      dwVidMemTotal                     AS DWORD
      dwVidMemFree                      AS DWORD
      dwMaxVisibleOverlays              AS DWORD
      dwCurrVisibleOverlays             AS DWORD
      dwNumFourCCCodes                  AS DWORD
      dwAlignBoundarySrc                AS DWORD
      dwAlignSizeSrc                    AS DWORD
      dwAlignBoundaryDest               AS DWORD
      dwAlignSizeDest                   AS DWORD
      dwAlignStrideAlign                AS DWORD
      dwRops(CONST DD_ROP_SPACE)        AS DWORD
      ddsOldCaps_dwCaps                 AS DWORD ' was ddsCaps DDSCAPS, in dx6 is ddsOldCaps DDSCAPS
      dwMinOverlayStretch               AS DWORD ' min overlay stretch factor * 1000
      dwMaxOverlayStretch               AS DWORD ' max overlay stretch factor * 1000
      dwMinLiveVideoStretch             AS DWORD ' min live video stretch factor * 1000
      dwMaxLiveVideoStretch             AS DWORD ' max live video stretch factor * 1000
      dwMinHwCodecStretch               AS DWORD ' min hardware codec stretch factor * 1000
      dwMaxHwCodecStretch               AS DWORD ' max hardware codec stretch factor * 1000
      dwReserved1                       AS DWORD
      dwReserved2                       AS DWORD
      dwReserved3                       AS DWORD
      dwSVBCaps                         AS DWORD
      dwSVBCKeyCaps                     AS DWORD
      dwSVBFXCaps                       AS DWORD
      dwSVBRops(CONST DD_ROP_SPACE)     AS DWORD
      dwVSBCaps                         AS DWORD
      dwVSBCKeyCaps                     AS DWORD
      dwVSBFXCaps                       AS DWORD
      dwVSBRops(CONST DD_ROP_SPACE)     AS DWORD
      dwSSBCaps                         AS DWORD
      dwSSBCKeyCaps                     AS DWORD
      dwSSBFXCaps                       AS DWORD
      dwSSBRops(CONST DD_ROP_SPACE)     AS DWORD
    ' Members added for DX5 release
      dwMaxVideoPorts                   AS DWORD ' maximum number of usable video ports
      dwCurrVideoPorts                  AS DWORD ' current number of video ports used
      dwSVBCaps2                        AS DWORD ' more driver specific capabilities for System->Vmem blts
      dwNLVBCaps                        AS DWORD ' driver specific capabilities for non-local->local vidmem blts
      dwNLVBCaps2                       AS DWORD ' more driver specific capabilities non-local->local vidmem blts
      dwNLVBCKeyCaps                    AS DWORD ' driver color key capabilities for non-local->local vidmem blts
      dwNLVBFXCaps                      AS DWORD ' driver FX capabilities for non-local->local blts
      dwNLVBRops(CONST DD_ROP_SPACE)    AS DWORD ' ROPS supported for non-local->local blts
    ' Members added for DX6 release
    '  ddsCaps			AS DDSCAPS2
      ddsCaps_lCaps      			   	AS LONG
      ddsCaps_lCaps2      		 	AS LONG
      ddsCaps_lCaps3      		 	AS LONG
      ddsCaps_lCaps4      		 	AS LONG
     END TYPE
'___________________________________________________________________
'

     TYPE DDPIXELFORMAT
      dwSize                       AS DWORD
      dwFlags                      AS DWORD
      dwFourCC                     AS DWORD
      dwRGBBitCount_UNION0         AS DWORD
      dwRGBZBitMask_UNION1         AS DWORD
      dwYUVBitCount_UNION2         AS DWORD
      dwYUVZBitMask_UNION3         AS DWORD
      dwZBufferBitDepth_UNION4     AS DWORD
      dwAlphaBitDepth              AS DWORD			'how many bits for alpha channels
      dwLuminanceAlphaBitMask      AS DWORD
      dwBumpLuminanceBitMask		 AS DWORD

     END TYPE

'
     TYPE DDOVERLAYFX
      dwSize                         AS DWORD
      dwAlphaEdgeBlendBitDepth       AS DWORD
      dwAlphaEdgeBlend               AS DWORD
      dwReserved                     AS DWORD
      dwAlphaDestConstBitDepth       AS DWORD
      UNION1                         AS DWORD
      dwAlphaSrcConstBitDepth        AS DWORD
      UNION2                         AS DWORD
     END TYPE
'___________________________________________________________________
'
     TYPE DDBLTBATCH
      lprDest          AS DWORD
      lpDDSSrc         AS DWORD
      lprSrc           AS DWORD
      dwFlags          AS DWORD
      lpDDBltFx        AS DWORD
     END TYPE


     TYPE DDGAMMARAMP
      red(256)            AS WORD    'DW 256 DUP (?)
      green(256)          AS WORD
      blue(256)           AS WORD
     END TYPE


'______________________________________________________________
'
     TYPE DDSURFACEDESC
      dwSize                                      AS DWORD
      dwFlags                                     AS DWORD
      dwHeight                                    AS DWORD
      dwWidth                                     AS DWORD
      UNION1                                      AS DWORD
      dwBackBufferCount                           AS DWORD
      UNION2                                      AS DWORD
      dwAlphaBitDepth                             AS DWORD
      dwReserved                                  AS DWORD
      lpSurface                                   AS DWORD
      ddckCKDestOverlay_dwColorSpaceLowValue	 	AS DWORD
      ddckCKDestOverlay_dwColorSpaceHighValue 	AS DWORD
      ddckCKDestBlt_dwColorSpaceLowValue		 	AS DWORD
      ddckCKDestBlt_dwColorSpaceHighValue         AS DWORD
      ddckCKSrcOverlay_dwColorSpaceLowValue       AS DWORD
      ddckCKSrcOverlay_dwColorSpaceHighValue    	AS DWORD
      ddckCKSrcBlt_dwColorSpaceLowValue    	 	AS DWORD
      ddckCKSrcBlt_dwColorSpaceHighValue   	 	AS DWORD
'''''''''''''    ddpfPixelFormat                 AS DDPIXELFORMAT
      ddpfPixelFormat_dwSize                      AS DWORD
      ddpfPixelFormat_dwFlags                     AS DWORD
      ddpfPixelFormat_dwFourCC                    AS DWORD
      ddpfPixelFormat_UNION1                      AS DWORD
      ddpfPixelFormat_UNION2                      AS DWORD
      ddpfPixelFormat_UNION3                      AS DWORD
      ddpfPixelFormat_UNION4                      AS DWORD
      ddpfPixelFormat_UNION5                      AS DWORD
      ddssurfCaps_dwCaps                          AS DWORD' was  AS DDSCAPS
     END TYPE
'______________________________________________________________
'

     TYPE DDSURFACEDESC2
      dwSize                                    AS DWORD
      dwFlags                                   AS DWORD
      dwHeight                                  AS DWORD
      dwWidth                                   AS DWORD
      UNION1                                    AS DWORD
      dwBackBufferCount                         AS DWORD
      UNION2                                    AS DWORD
      dwAlphaBitDepth                           AS DWORD
      dwReserved                                AS DWORD
      lpSurface                                 AS DWORD
      ddckCKDestOverlay_dwColorSpaceLowValue    AS DWORD
      ddckCKDestOverlay_dwColorSpaceHighValue   AS DWORD
      ddckCKDestBlt_dwColorSpaceLowValue        AS DWORD
      ddckCKDestBlt_dwColorSpaceHighValue       AS DWORD
      ddckCKSrcOverlay_dwColorSpaceLowValue     AS DWORD
      ddckCKSrcOverlay_dwColorSpaceHighValue    AS DWORD
      ddckCKSrcBlt_dwColorSpaceLowValue         AS DWORD
      ddckCKSrcBlt_dwColorSpaceHighValue        AS DWORD
'''''''''''    ddpfPixelFormat                AS DDPIXELFORMAT
      ddpfPixelFormat_dwSize                    AS DWORD
      ddpfPixelFormat_dwFlags                   AS DWORD
      ddpfPixelFormat_dwFourCC                  AS DWORD
      ddpfPixelFormat_UNION1                    AS DWORD
      ddpfPixelFormat_UNION2                    AS DWORD
      ddpfPixelFormat_UNION3                    AS DWORD
      ddpfPixelFormat_UNION4                    AS DWORD
      ddpfPixelFormat_UNION5                    AS DWORD
'''''''''''    ddssurfCaps                    AS DDSCAPS2
      ddssurfCaps_lCaps                         AS LONG
      ddssurfCaps_lCaps2                        AS LONG
      ddssurfCaps_lCaps3                        AS LONG
      ddssurfCaps_lCaps4                        AS LONG
      dwTextureStage                            AS DWORD
     END TYPE
'_______________________________________________________________
'
     TYPE DDOPTSURFACEDESC
      dwSize              AS DWORD    ' size of the DDOPTSURFACEDESC structure
      dwFlags             AS DWORD    ' determines what fields are valid
'    ddSCaps             AS DDSCAPS2 ' Common caps like: Memory type
      lCaps               AS LONG
      lCaps2              AS LONG
      lCaps3              AS LONG
      lCaps4              AS LONG
      ddOSCaps            AS DWORD ' Common caps like: Memory type
      guid                AS STRING * 16 ' Compression technique GUID
      dwCompressionRatio  AS DWORD    ' Compression ratio
     END TYPE

     TYPE DDCOLORCONTROL
      dwSize          AS DWORD
      dwFlags         AS DWORD
      lBrightness     AS DWORD
      lContrast       AS DWORD
      lHue            AS DWORD
      lSaturation     AS DWORD
      lSharpness      AS DWORD
      lGamma          AS DWORD
      lColorEnable    AS DWORD
      dwReserved1     AS DWORD
     END TYPE


     TYPE DDDEVICEIDENTIFIER
    '
    ' These elements are for presentation to the user only. They should not be used to identify particular
    ' drivers, since this is unreliable and many different strings may be associated with the same
    ' device, and the same driver from different vendors.
    '

      szDriver(CONST MAX_DDDEVICEID_STRING)      AS BYTE
      szDescription(CONST MAX_DDDEVICEID_STRING) AS BYTE
    ' This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
    ' on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
    ' drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
    '
    ' This version has the form:
    '  wProduct = HIWORD(liDriverVersion.HighPart)
    '  wVersion = LOWORD(liDriverVersion.HighPart)
    '  wSubVersion = HIWORD(liDriverVersion.LowPart)
    '  wBuild = LOWORD(liDriverVersion.LowPart)
    '
      liDriverVersion         AS QUAD 'DQ ?
    ' These elements can be used to identify particular chipsets. Use with extreme caution.
    '   dwVendorId     Identifies the manufacturer. May be zero if unknown.
    '   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
    '   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
    '   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
      dwVendorId              AS DWORD
      dwDeviceId              AS DWORD
      dwSubSysId              AS DWORD
      dwRevision              AS DWORD
    ' This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
    ' driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
    ' reprofile the graphics subsystem.
    ' This element can also be used to identify particular problematic drivers.

      guidDeviceIdentifier    AS STRING * 16     'GUID
     END TYPE


     TYPE DDDEVICEIDENTIFIER2
    '
    ' These elements are for presentation to the user only. They should not be used to identify particular
    ' drivers, since this is unreliable and many different strings may be associated with the same
    ' device, and the same driver from different vendors.
    '

      szDriver(CONST MAX_DDDEVICEID_STRING)      AS BYTE
      szDescription(CONST MAX_DDDEVICEID_STRING) AS BYTE
    ' This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons
    ' on the whole 64 bits. Caution should be exercised if you use this element to identify problematic
    ' drivers. It is recommended that guidDeviceIdentifier is used for this purpose.
    '
    ' This version has the form:
    '  wProduct = HIWORD(liDriverVersion.HighPart)
    '  wVersion = LOWORD(liDriverVersion.HighPart)
    '  wSubVersion = HIWORD(liDriverVersion.LowPart)
    '  wBuild = LOWORD(liDriverVersion.LowPart)
    '
      liDriverVersion         AS QUAD 'DQ ?
    ' These elements can be used to identify particular chipsets. Use with extreme caution.
    '   dwVendorId     Identifies the manufacturer. May be zero if unknown.
    '   dwDeviceId     Identifies the type of chipset. May be zero if unknown.
    '   dwSubSysId     Identifies the subsystem, typically this means the particular board. May be zero if unknown.
    '   dwRevision     Identifies the revision level of the chipset. May be zero if unknown.
      dwVendorId              AS DWORD
      dwDeviceId              AS DWORD
      dwSubSysId              AS DWORD
      dwRevision              AS DWORD
    ' This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the
    ' driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to
    ' reprofile the graphics subsystem.
    ' This element can also be used to identify particular problematic drivers.

      guidDeviceIdentifier    AS STRING * 16     'GUID
    ' This element is used to determine the Windows Hardware Quality Lab (WHQL)
    ' certification level for this driver/device pair.
    '
      dwWHQLLevel             AS DWORD
     END TYPE


'==============================================================================
'                                  CALLBACKS ....
'==============================================================================

'  ClipperCallback = function(lpDDClipper: IDirectDrawClipper; hWnd: HWND; Code: DWORD; lpContext: Pointer): HResult; stdcall;
'  LPCLIPPERCALLBACK = ClipperCallback;

'  SurfacesStreamingCallback = function(Arg: DWORD): HResult; stdcall;
'  LPSURFACESTREAMINGCALLBACK =SurfacesStreamingCallback;

'  DDEnumModesCallback = function(const lpDDSurfaceDesc: DDSurfaceDesc; lpContext: Pointer): HResult; stdcall;
'  LPDDENUMMODESCALLBACK = DDEnumModesCallback;

'  DDEnumModesCallback2 = function(const lpDDSurfaceDesc: DDSurfaceDesc2; lpContext: Pointer): HResult; stdcall;
'  LPDDENUMMODESCALLBACK2 = DDEnumModesCallback2;

'  DDEnumSurfacesCallback = function(lpDDSurface: IDirectDrawSurface; const lpDDSurfaceDesc: DDSurfaceDesc; lpContext: Pointer): HResult; stdcall;
'  LPDDENUMSURFACESCALLBACK = DDEnumSurfacesCallback;

'  DDEnumSurfacesCallback2 = function(lpDDSurface: IDirectDrawSurface4; const lpDDSurfaceDesc: DDSurfaceDesc2; lpContext: Pointer): HResult; stdcall;
'  LPDDENUMSURFACESCALLBACK2 = DDEnumSurfacesCallback2;

'  DDEnumSurfacesCallback7 = function(lpDDSurface: IDirectDrawSurface7; const lpDDSurfaceDesc: DDSurfaceDesc2; lpContext: Pointer): HResult; stdcall;
'  LPDDENUMSURFACESCALLBACK7 = DDEnumSurfacesCallback7;

'  DDEnumCallbackA = function(lpGUID: PGUID; lpDriverDescription: LPSTR; lpDriverName: LPSTR; lpContext: Pointer): BOOL; stdcall;
'  LPDDENUMCALLBACKA = DDEnumCallbackA;

'  DDEnumCallbackW = function(lpGUID: PGUID; lpDriverDescription: LPWSTR; lpDriverName: LPWSTR; lpContext: Pointer): BOOL; stdcall;
'  LPDDENUMCALLBACKW = DDEnumCallbackW;

'  DDEnumCallback = DDEnumCallbackA;
'  LPDDENUMCALLBACK = DDEnumCallback;

'  DDEnumCallbackExA = function(lpGUID: PGUID; lpDriverDescription: LPSTR; lpDriverName: LPSTR; lpContext: Pointer; Monitor: LONG): BOOL; stdcall;
'  LPDDENUMCALLBACKEXA = DDEnumCallbackExA;

'  DDEnumCallbackExW = function(lpGUID: PGUID; lpDriverDescription: LPWSTR; lpDriverName: LPWSTR; lpContext: Pointer; Monitor: LONG): BOOL; stdcall;
'  LPDDENUMCALLBACKEXW = DDEnumCallbackExW;

'  DDEnumCallbackEx = DDEnumCallbackExA;
'  LPDDENUMCALLBACKEX = DDEnumCallbackEx;


'==============================================================================
'                                    METHODS...
'==============================================================================

' IUnknown methods-- all directx interfaces inherit from this class
' but rapidq does not support inheritance of extended class!!!
' we need to add this section to each interface... yuck...


     TYPE IUnknown EXTENDS QOBJECT
PUBLIC:
      DIM lpIpointer		AS LONG			'interface base pointer address (THIS)
PRIVATE:
      DIM ParmArray(16)	AS DWORD		'holds up to 16 argument values (function parameters)
      DIM lpArray			AS LONG			'pointer to array of parameters
      DIM IOffset			AS LONG			'each sub/function called by base address + offset
      lpArray = VARPTR(ParmArray(0))		'get pointer

      FUNCTION QueryInterface(lpIUnknown AS LONG, riid AS STRING * 16, ppvObj AS LONG) AS LONG
       IOffset = 0
       CallPointerManyArgs(lpIpointer + IOffset, lpArray)             'for COM calling
       FUNCTION AddRef(lpIUnknown AS LONG) AS LONG							'should call this after queryinterface
        IOffset = 4
        FUNCTION Release(lpIUnknown AS LONG) AS LONG
         IOffset = 8
        END TYPE




' IDirectDraw7 Interface

        TYPE IDirectDraw7 EXTENDS QOBJECT   'IUnknown
'    ['{15E65EC0-3B9C-11D2-B92F-00609797EA5B}']

         FUNCTION CreateNew() AS LONG			'non standard, use this to create the DDRAW object
          DIM ddrval	AS HRESULT
          ddrval = DirectDrawCreate(0, @lpIpointer, 0)
          IF ddrVal <> DD_OK THEN ReportDDError(ddrVal)
	'ShowMessage str$(lpDD)		'this is the address of the base pointer (its value points to the code)
         END FUNCTION

    ' IDirectDraw methods
         FUNCTION Compact() AS LONG		'unsupported?
          FUNCTION CreateClipper(BYVAL dwFlags AS DWORD, lpDDClipper AS LONG, pUnkOuter AS LONG) AS HResult
           FUNCTION CreatePalette(dwFlags AS DWORD, lpColorTable AS PPaletteEntry, BYREF  lplpDDPalette AS IDirectDrawPalette, pUnkOuter AS IUnknown) AS HResult
            FUNCTION CreateSurface(CONST lpDDSurfaceDesc AS DDSurfaceDesc2, BYREF  lplpDDSurface AS IDirectDrawSurface7, pUnkOuter AS IUnknown) AS HResult
             FUNCTION DuplicateSurface(lpDDSurface AS IDirectDrawSurface7, BYREF  lplpDupDDSurface AS IDirectDrawSurface7) AS HResult
              FUNCTION EnumDisplayModes(dwFlags AS DWORD, CONST lpDDSurfaceDesc AS DDSurfaceDesc2, lpContext AS Pointer, lpEnumModesCallback AS DDEnumModesCallback2) AS HResult
               FUNCTION EnumSurfaces(dwFlags AS DWORD, CONST lpDDSD AS DDSurfaceDesc2, lpContext AS Pointer, lpEnumCallback AS DDEnumSurfacesCallback7) AS HResult
                FUNCTION FlipToGDISurface () AS HResult
                 FUNCTION GetCaps(BYREF lpDDDriverCaps AS DDCaps, BYREF lpDDHELCaps AS DDCaps) AS HResult
                  FUNCTION GetDisplayMode(BYREF lpDDSurfaceDesc AS DDSurfaceDesc2) AS HResult
                   FUNCTION GetFourCCCodes(BYREF lpNumCodes, lpCodes AS DWORD) AS HResult
                    FUNCTION GetGDISurface(BYREF lplpGDIDDSSurface AS IDirectDrawSurface7) AS HResult
                     FUNCTION GetMonitorFrequency(BYREF lpdwFrequency AS DWORD) AS HResult
                      FUNCTION GetScanLine(BYREF lpdwScanLine AS DWORD) AS HResult
                       FUNCTION GetVerticalBlankStatus(BYREF lpbIsInVB AS BOOL) AS HResult
                        FUNCTION Initialize(lpGUID AS PGUID) AS HResult
                         FUNCTION RestoreDisplayMode AS HResult
                          FUNCTION SetCooperativeLevel(hWnd AS HWND, dwFlags AS DWORD) AS HResult
                           FUNCTION SetDisplayMode(dwWidth, dwHeight, dwBPP, dwRefreshRate AS DWORD, dwFlags AS DWORD) AS HResult
                            FUNCTION WaitForVerticalBlank(dwFlags AS DWORD, hEvent AS THandle) AS HResult
    ' IDirectDraw2 methods
                             FUNCTION GetAvailableVidMem(BYREF lpDDSCaps AS DDSCaps, BYREF lpdwTotal, lpdwFree AS DWORD) AS HResult
    ' IDirectDraw4 methods
                              FUNCTION GetSurfaceFromDC(hdc AS HDC, lpDDS AS IDirectDrawSurface4) AS HResult
                               FUNCTION RestoreAllSurfaces AS HResult
                                FUNCTION TestCooperativeLevel AS HResult
                                 FUNCTION GetDeviceIdentifier(BYREF lpdddi AS DDDeviceIdentifier, dwFlags AS DWORD) AS HResult
    ' IDirectDraw7 methods
                                  FUNCTION StartModeTest(BYREF lpModesToTest AS TSize, dwNumEntries AS DWORD, dwFlags AS DWORD) AS HResult
                                   FUNCTION EvaluateMode(dwFlags AS DWORD, BYREF pSecondsUntilTimeout AS DWORD) AS HResult
                                   END TYPE


' IDirectDrawPalette Interface

                                   TYPE  IDirectDrawPalette EXTENDS QOBJECT   'IUnknown
'    ['{6C14DB84-A733-11CE-A521-0020AF0BE560}']
    ' IDirectDrawPalette methods
                                    FUNCTION GetCaps(varlpdwCaps AS DWORD) AS HResult
                                     FUNCTION GetEntries(dwFlags AS DWORD, dwBase AS DWORD, dwNumEntries AS DWORD, lpEntries AS PPaletteEntry) AS HResult
                                      FUNCTION Initialize(lpDD AS IDirectDraw, dwFlags AS DWORD, lpDDColorTable AS PPaletteEntry) AS HResult
                                       FUNCTION SetEntries(dwFlags AS DWORD, dwStartingEntry AS DWORD, dwCount AS DWORD, lpEntries AS PPaletteEntry) AS HResult
                                       END TYPE

' IDirectDrawClipper Interface

                                       TYPE  IDirectDrawClipper EXTENDS QOBJECT   'IUnknown
'    ['{6C14DB85-A733-11CE-A521-0020AF0BE560}']
    ' IDirectDrawClipper methods
                                        FUNCTION GetClipList(CONST lpRect AS TRect, lpClipList AS PRgnData, BYREF lpdwSize AS DWORD) AS HResult
                                         FUNCTION GetHWnd(BYREF lphWnd AS HWND) AS HResult
                                          FUNCTION Initialize(lpDD AS IDirectDraw, dwFlags AS DWORD) AS HResult
                                           FUNCTION IsClipListChanged(BYREF lpbChanged AS BOOL) AS HResult
                                            FUNCTION SetClipList(lpClipList AS PRgnData, dwFlags AS DWORD) AS HResult
                                             FUNCTION SetHWnd(dwFlags AS DWORD, hWnd AS HWND) AS HResult
                                             END TYPE

' IDirectDrawSurface7 Interface

                                             TYPE  IDirectDrawSurface7 EXTENDS QOBJECT   'IUnknown
'    ['{06675A80-3B9B-11D2-B92F-00609797EA5B}']
    ' IDirectDrawSurface methods
                                              FUNCTION AddAttachedSurface(lpDDSAttachedSurface AS IDirectDrawSurface7) AS HResult
                                               FUNCTION AddOverlayDirtyRect(CONST lpRect AS TRect) AS HResult
                                                FUNCTION Blt(CONST lpDestRect AS TRect, lpDDSrcSurface AS IDirectDrawSurface7, CONST lpSrcRect AS TRect, dwFlags AS DWORD, CONST lpDDBltFx AS DDBltFX) AS HResult
                                                 FUNCTION BltBatch(CONST lpDDBltBatch AS DDBltBatch, dwCount AS DWORD, dwFlags AS DWORD) AS HResult
                                                  FUNCTION BltFast(dwX, dwY AS DWORD, lpDDSrcSurface AS IDirectDrawSurface7, CONST lpSrcRect AS TRect, dwTrans AS DWORD) AS HResult
                                                   FUNCTION DeleteAttachedSurface(dwFlags AS DWORD, lpDDSAttachedSurface AS IDirectDrawSurface7) AS HResult
                                                    FUNCTION EnumAttachedSurfaces(lpContext AS Pointer, lpEnumSurfacesCallback AS DDEnumSurfacesCallback7) AS HResult
                                                     FUNCTION EnumOverlayZOrders(dwFlags AS DWORD, lpContext AS Pointer, lpfnCallback AS DDEnumSurfacesCallback7) AS HResult
                                                      FUNCTION Flip(lpDDSurfaceTargetOverride AS IDirectDrawSurface7, dwFlags AS DWORD) AS HResult
                                                       FUNCTION GetAttachedSurface(BYREF lpDDSCaps AS DDSCaps2, BYREF  lplpDDAttachedSurface AS IDirectDrawSurface7) AS HResult
                                                        FUNCTION GetBltStatus(dwFlags AS DWORD) AS HResult
                                                         FUNCTION GetCaps(BYREF lpDDSCaps AS DDSCaps2) AS HResult
                                                          FUNCTION GetClipper(BYREF lplpDDClipper AS IDirectDrawClipper) AS HResult
                                                           FUNCTION GetColorKey(dwFlags AS DWORD, BYREF lpDDColorKey AS DDColorKey) AS HResult
                                                            FUNCTION GetDC(BYREF lphDC AS HDC) AS HResult
                                                             FUNCTION GetFlipStatus(dwFlags AS DWORD) AS HResult
                                                              FUNCTION GetOverlayPosition(BYREF lplX, lplY AS Longint) AS HResult
                                                               FUNCTION GetPalette(BYREF lplpDDPalette AS IDirectDrawPalette) AS HResult
                                                                FUNCTION GetPixelFormat(BYREF lpDDPixelFormat AS DDPixelFormat) AS HResult
                                                                 FUNCTION GetSurfaceDesc(BYREF lpDDSurfaceDesc AS DDSurfaceDesc2) AS HResult
                                                                  FUNCTION Initialize(lpDD AS IDirectDraw, CONST lpDDSurfaceDesc AS DDSurfaceDesc2) AS HResult
                                                                   FUNCTION IsLost AS HResult
                                                                    FUNCTION Lock(lpDestRect AS PRect, CONST lpDDSurfaceDesc AS DDSurfaceDesc2, dwFlags AS DWORD, hEvent AS THandle) AS HResult
                                                                     FUNCTION ReleaseDC(hDC AS HDC) AS HResult
                                                                      FUNCTION RESTORE AS HResult
                                                                       FUNCTION SetClipper(lpDDClipper AS IDirectDrawClipper) AS HResult
                                                                        FUNCTION SetColorKey(dwFlags AS DWORD, CONST lpDDColorKey AS DDColorKey) AS HResult
                                                                         FUNCTION SetOverlayPosition(lX, lY AS Longint) AS HResult
                                                                          FUNCTION SetPalette(lpDDPalette AS IDirectDrawPalette) AS HResult
                                                                           FUNCTION Unlock(lpSurfaceData AS Pointer) AS HResult
                                                                            FUNCTION UpdateOverlay(CONST lpSrcRect AS TRect, lpDDDestSurface AS IDirectDrawSurface7, CONST lpDestRect AS TRect, dwFlags AS DWORD, CONST lpDDOverlayFx AS DDOverlayFX) AS HResult
                                                                             FUNCTION UpdateOverlayDisplay(dwFlags AS DWORD) AS HResult
                                                                              FUNCTION UpdateOverlayZOrder(dwFlags AS DWORD, lpDDSReference AS IDirectDrawSurface7) AS HResult
    ' IDirectDrawSurface2 methods
                                                                               FUNCTION GetDDInterface(BYREF lplpDD AS IUnknown) AS HResult
                                                                                FUNCTION PageLock(dwFlags AS DWORD) AS HResult
                                                                                 FUNCTION PageUnlock(dwFlags AS DWORD) AS HResult
    ' IDirectDrawSurface3 methods
                                                                                  FUNCTION SetSurfaceDesc(CONST lpddsd AS DDSurfaceDesc2, dwFlags AS DWORD) AS HResult
    ' IDirectDrawSurface4 methods
                                                                                   FUNCTION SetPrivateData(CONST guidTag AS TGUID, lpData AS Pointer,
                                                                                    cbSize AS DWORD, dwFlags AS DWORD) AS HResult
                                                                                    FUNCTION GetPrivateData(CONST guidTag AS TGUID, lpData AS Pointer,
                                                                                     BYREF cbSize AS DWORD) AS HResult
                                                                                     FUNCTION FreePrivateData(CONST guidTag AS TGUID) AS HResult
                                                                                      FUNCTION GetUniquenessValue(BYREF lpValue AS DWORD) AS HResult
                                                                                       FUNCTION ChangeUniquenessValue AS HResult
    ' Moved Texture7 methods here
                                                                                        FUNCTION SetPriority(dwPriority AS DWORD) AS HResult
                                                                                         FUNCTION GetPriority(BYREF lpdwPriority AS DWORD) AS HResult
                                                                                          FUNCTION SetLOD(dwMaxLOD AS DWORD) AS HResult
                                                                                           FUNCTION GetLOD(BYREF lpdwMaxLOD AS DWORD) AS HResult
                                                                                           END TYPE

' IDirectDrawColorControl Interface

                                                                                           TYPE  IDirectDrawColorControl EXTENDS QOBJECT   'IUnknown
                                                                                            ['{4B9F0EE0-0D7E-11D0-9B06-00A0C903A3B8}']
    ' IDirectDrawColorControl methods
                                                                                            FUNCTION GetColorControls(BYREF lpColorControl AS DDColorControl) AS HResult
                                                                                             FUNCTION SetColorControls(CONST lpColorControl AS DDColorControl) AS HResult
                                                                                             END TYPE


' IDirectDrawGammaControl Interface
' Use IDirectDrawGammaControl to set red, green, and blue gamma ramp levels of the DD surface
' you get a pointer to this interface by calling its IUnknown::QueryInterface method of a
' DirectDrawSurface object, specifying the IID_IDirectDrawGammaControl ref identifier
                                                                                             TYPE  IDirectDrawGammaControl EXTENDS QOBJECT   'IUnknown
'    ['{69C11C3E-B46B-11D1-AD7A-00C04FC29B4E}']
    ' IDirectDrawGammaControl methods
                                                                                              FUNCTION GetGammaRamp(dwFlags AS DWORD, BYREF lpRampData AS DDGammaRamp) AS HResult
                                                                                               FUNCTION SetGammaRamp(dwFlags AS DWORD, BYREF lpRampData AS DDGammaRamp) AS HResult
                                                                                               END TYPE

' ********************************************************
'                CONSTANTS
' ********************************************************
' Flags for DirectDrawEnumerateEx
                                                                                               CONST  DDENUM_ATTACHEDSECONDARYDEVICES = &h00000001
                                                                                               CONST  DDENUM_DETACHEDSECONDARYDEVICES = &h00000002
                                                                                               CONST  DDENUM_NONDISPLAYDEVICES        = &h00000004



' ddsCaps field is valid.
                                                                                               CONST  DDSD_CAPS               = &h00000001     ' default
                                                                                               CONST  DDSD_HEIGHT             = &h00000002
                                                                                               CONST  DDSD_WIDTH              = &h00000004
                                                                                               CONST  DDSD_PITCH              = &h00000008
                                                                                               CONST  DDSD_BACKBUFFERCOUNT    = &h00000020
                                                                                               CONST  DDSD_ZBUFFERBITDEPTH    = &h00000040
                                                                                               CONST  DDSD_ALPHABITDEPTH      = &h00000080
                                                                                               CONST  DDSD_LPSURFACE          = &h00000800
                                                                                               CONST  DDSD_PIXELFORMAT        = &h00001000
                                                                                               CONST  DDSD_CKDESTOVERLAY      = &h00002000
                                                                                               CONST  DDSD_CKDESTBLT          = &h00004000
                                                                                               CONST  DDSD_CKSRCOVERLAY       = &h00008000
                                                                                               CONST  DDSD_CKSRCBLT           = &h00010000
                                                                                               CONST  DDSD_MIPMAPCOUNT        = &h00020000
                                                                                               CONST  DDSD_REFRESHRATE        = &h00040000
                                                                                               CONST  DDSD_LINEARSIZE         = &h00080000
                                                                                               CONST  DDSD_TEXTURESTAGE       = &h00100000
                                                                                               CONST  DDSD_FVF                = &h00200000
                                                                                               CONST  DDSD_SRCVBHANDLE        = &h00400000
                                                                                               CONST  DDSD_ALL                = &h007ff9ee

' DirectDraw Driver Capability Flags

                                                                                               CONST  DDCAPS_3D                   = &h00000001
                                                                                               CONST  DDCAPS_ALIGNBOUNDARYDEST    = &h00000002
                                                                                               CONST  DDCAPS_ALIGNSIZEDEST        = &h00000004
                                                                                               CONST  DDCAPS_ALIGNBOUNDARYSRC     = &h00000008
                                                                                               CONST  DDCAPS_ALIGNSIZESRC         = &h00000010
                                                                                               CONST  DDCAPS_ALIGNSTRIDE          = &h00000020
                                                                                               CONST  DDCAPS_BLT                  = &h00000040
                                                                                               CONST  DDCAPS_BLTQUEUE             = &h00000080
                                                                                               CONST  DDCAPS_BLTFOURCC            = &h00000100
                                                                                               CONST  DDCAPS_BLTSTRETCH           = &h00000200
                                                                                               CONST  DDCAPS_GDI                  = &h00000400
                                                                                               CONST  DDCAPS_OVERLAY              = &h00000800
                                                                                               CONST  DDCAPS_OVERLAYCANTCLIP      = &h00001000
                                                                                               CONST  DDCAPS_OVERLAYFOURCC        = &h00002000
                                                                                               CONST  DDCAPS_OVERLAYSTRETCH       = &h00004000
                                                                                               CONST  DDCAPS_PALETTE              = &h00008000
                                                                                               CONST  DDCAPS_PALETTEVSYNC         = &h00010000
                                                                                               CONST  DDCAPS_READSCANLINE         = &h00020000
                                                                                               CONST  DDCAPS_STEREOVIEW           = &h00040000
                                                                                               CONST  DDCAPS_VBI                  = &h00080000
                                                                                               CONST  DDCAPS_ZBLTS                = &h00100000
                                                                                               CONST  DDCAPS_ZOVERLAYS            = &h00200000
                                                                                               CONST  DDCAPS_COLORKEY             = &h00400000
                                                                                               CONST  DDCAPS_ALPHA                = &h00800000
                                                                                               CONST  DDCAPS_COLORKEYHWASSIST     = &h01000000
                                                                                               CONST  DDCAPS_NOHARDWARE           = &h02000000
                                                                                               CONST  DDCAPS_BLTCOLORFILL         = &h04000000
                                                                                               CONST  DDCAPS_BANKSWITCHED         = &h08000000
                                                                                               CONST  DDCAPS_BLTDEPTHFILL         = &h10000000
                                                                                               CONST  DDCAPS_CANCLIP              = &h20000000
                                                                                               CONST  DDCAPS_CANCLIPSTRETCHED     = &h40000000
                                                                                               CONST  DDCAPS_CANBLTSYSMEM         = &h80000000

' More DirectDraw Driver Capability Flags (dwCaps2)

                                                                                               CONST  DDCAPS2_CERTIFIED            = &h00000001
                                                                                               CONST  DDCAPS2_NO2DDURING3DSCENE    = &h00000002
                                                                                               CONST  DDCAPS2_VIDEOPORT            = &h00000004
                                                                                               CONST  DDCAPS2_AUTOFLIPOVERLAY      = &h00000008
                                                                                               CONST  DDCAPS2_CANBOBINTERLEAVED    = &h00000010
                                                                                               CONST  DDCAPS2_CANBOBNONINTERLEAVED = &h00000020
                                                                                               CONST  DDCAPS2_COLORCONTROLOVERLAY  = &h00000040
                                                                                               CONST  DDCAPS2_COLORCONTROLPRIMARY  = &h00000080
                                                                                               CONST  DDCAPS2_CANDROPZ16BIT        = &h00000100
                                                                                               CONST  DDCAPS2_NONLOCALVIDMEM       = &h00000200
                                                                                               CONST  DDCAPS2_NONLOCALVIDMEMCAPS   = &h00000400
                                                                                               CONST  DDCAPS2_NOPAGELOCKREQUIRED   = &h00000800
                                                                                               CONST  DDCAPS2_WIDESURFACES         = &h00001000
                                                                                               CONST  DDCAPS2_CANFLIPODDEVEN       = &h00002000
                                                                                               CONST  DDCAPS2_CANBOBHARDWARE       = &h00004000
                                                                                               CONST  DDCAPS2_COPYFOURCC           = &h00008000
                                                                                               CONST  DDCAPS2_PRIMARYGAMMA         = &h00020000
                                                                                               CONST  DDCAPS2_CANRENDERWINDOWED    = &h00080000
                                                                                               CONST  DDCAPS2_CANCALIBRATEGAMMA    = &h00100000
                                                                                               CONST  DDCAPS2_FLIPINTERVAL         = &h00200000
                                                                                               CONST  DDCAPS2_FLIPNOVSYNC          = &h00400000
                                                                                               CONST  DDCAPS2_CANMANAGETEXTURE     = &h00800000
                                                                                               CONST  DDCAPS2_TEXMANINNONLOCALVIDMEM = &h01000000
                                                                                               CONST  DDCAPS2_STEREO                 = &h02000000
                                                                                               CONST  DDCAPS2_SYSTONONLOCAL_AS_SYSTOLOCAL = &h04000000

' DirectDrawSurface Capability Flags

                                                                                               CONST  DDSCAPS_RESERVED1           = &h00000001 ' DDSCAPS_3D
                                                                                               CONST  DDSCAPS_ALPHA               = &h00000002
                                                                                               CONST  DDSCAPS_BACKBUFFER          = &h00000004
                                                                                               CONST  DDSCAPS_COMPLEX             = &h00000008
                                                                                               CONST  DDSCAPS_FLIP                = &h00000010
                                                                                               CONST  DDSCAPS_FRONTBUFFER         = &h00000020
                                                                                               CONST  DDSCAPS_OFFSCREENPLAIN      = &h00000040
                                                                                               CONST  DDSCAPS_OVERLAY             = &h00000080
                                                                                               CONST  DDSCAPS_PALETTE             = &h00000100
                                                                                               CONST  DDSCAPS_PRIMARYSURFACE      = &h00000200
                                                                                               CONST  DDSCAPS_RESERVED3           = &h00000400 ' DDSCAPS_PRIMARYSURFACELEFT
                                                                                               CONST  DDSCAPS_SYSTEMMEMORY        = &h00000800
                                                                                               CONST  DDSCAPS_TEXTURE             = &h00001000
                                                                                               CONST  DDSCAPS_3DDEVICE            = &h00002000
                                                                                               CONST  DDSCAPS_VIDEOMEMORY         = &h00004000
                                                                                               CONST  DDSCAPS_VISIBLE             = &h00008000
                                                                                               CONST  DDSCAPS_WRITEONLY           = &h00010000
                                                                                               CONST  DDSCAPS_ZBUFFER             = &h00020000
                                                                                               CONST  DDSCAPS_OWNDC               = &h00040000
                                                                                               CONST  DDSCAPS_LIVEVIDEO           = &h00080000
                                                                                               CONST  DDSCAPS_HWCODEC             = &h00100000
                                                                                               CONST  DDSCAPS_MODEX               = &h00200000
                                                                                               CONST  DDSCAPS_MIPMAP              = &h00400000
                                                                                               CONST  DDSCAPS_RESERVED2           = &h00800000
                                                                                               CONST  DDSCAPS_ALLOCONLOAD         = &h04000000
                                                                                               CONST  DDSCAPS_VIDEOPORT           = &h08000000
                                                                                               CONST  DDSCAPS_LOCALVIDMEM         = &h10000000
                                                                                               CONST  DDSCAPS_NONLOCALVIDMEM      = &h20000000
                                                                                               CONST  DDSCAPS_STANDARDVGAMODE     = &h40000000
                                                                                               CONST  DDSCAPS_OPTIMIZED           = &h80000000

' DirectDrawSurface Capability Flags 2

                                                                                               CONST  DDSCAPS2_HARDWAREDEINTERLACE = &h00000002
                                                                                               CONST  DDSCAPS2_HINTDYNAMIC         = &h00000004
                                                                                               CONST  DDSCAPS2_HINTSTATIC          = &h00000008
                                                                                               CONST  DDSCAPS2_TEXTUREMANAGE       = &h00000010
                                                                                               CONST  DDSCAPS2_RESERVED1           = &h00000020
                                                                                               CONST  DDSCAPS2_RESERVED2           = &h00000040
                                                                                               CONST  DDSCAPS2_OPAQUE              = &h00000080
                                                                                               CONST  DDSCAPS2_HINTANTIALIASING    = &h00000100
                                                                                               CONST  DDSCAPS2_CUBEMAP             = &h00000200
                                                                                               CONST  DDSCAPS2_CUBEMAP_POSITIVEX   = &h00000400
                                                                                               CONST  DDSCAPS2_CUBEMAP_NEGATIVEX   = &h00000800
                                                                                               CONST  DDSCAPS2_CUBEMAP_POSITIVEY   = &h00001000
                                                                                               CONST  DDSCAPS2_CUBEMAP_NEGATIVEY   = &h00002000
                                                                                               CONST  DDSCAPS2_CUBEMAP_POSITIVEZ   = &h00004000
                                                                                               CONST  DDSCAPS2_CUBEMAP_NEGATIVEZ   = &h00008000

                                                                                               CONST  DDSCAPS2_CUBEMAP_ALLFACES    =_
                                                                                                DDSCAPS2_CUBEMAP_POSITIVEX OR DDSCAPS2_CUBEMAP_NEGATIVEX or_
                                                                                                DDSCAPS2_CUBEMAP_POSITIVEY OR DDSCAPS2_CUBEMAP_NEGATIVEY or_
                                                                                                DDSCAPS2_CUBEMAP_POSITIVEZ OR DDSCAPS2_CUBEMAP_NEGATIVEZ

                                                                                               CONST  DDSCAPS2_MIPMAPSUBLEVEL      = &h00010000
                                                                                               CONST  DDSCAPS2_D3DTEXTUREMANAGE    = &h00020000
                                                                                               CONST  DDSCAPS2_DONOTPERSIST        = &h00040000
                                                                                               CONST  DDSCAPS2_STEREOSURFACELEFT   = &h00080000

' DDOptSurfaceDesc flags

                                                                                               CONST  DDOSD_GUID              = &h00000001
                                                                                               CONST  DDOSD_COMPRESSION_RATIO = &h00000002
                                                                                               CONST  DDOSD_SCAPS             = &h00000004
                                                                                               CONST  DDOSD_OSCAPS            = &h00000008
                                                                                               CONST  DDOSD_ALL               = &h0000000F

' ddOSCaps field is valid.

                                                                                               CONST  DDOSDCAPS_OPTCOMPRESSED    = &h00000001
                                                                                               CONST  DDOSDCAPS_OPTREORDERED     = &h00000002
                                                                                               CONST  DDOSDCAPS_MONOLITHICMIPMAP = &h00000004
                                                                                               CONST  DDOSDCAPS_VALIDSCAPS       = &h30004800
                                                                                               CONST  DDOSDCAPS_VALIDOSCAPS      = &h00000007

' DirectDraw FX Alpha Capability Flags

                                                                                               CONST  DDFXALPHACAPS_BLTALPHAEDGEBLEND         = &h00000001
                                                                                               CONST  DDFXALPHACAPS_BLTALPHAPIXELS            = &h00000002
                                                                                               CONST  DDFXALPHACAPS_BLTALPHAPIXELSNEG         = &h00000004
                                                                                               CONST  DDFXALPHACAPS_BLTALPHASURFACES          = &h00000008
                                                                                               CONST  DDFXALPHACAPS_BLTALPHASURFACESNEG       = &h00000010
                                                                                               CONST  DDFXALPHACAPS_OVERLAYALPHAEDGEBLEND     = &h00000020
                                                                                               CONST  DDFXALPHACAPS_OVERLAYALPHAPIXELS        = &h00000040
                                                                                               CONST  DDFXALPHACAPS_OVERLAYALPHAPIXELSNEG     = &h00000080
                                                                                               CONST  DDFXALPHACAPS_OVERLAYALPHASURFACES      = &h00000100
                                                                                               CONST  DDFXALPHACAPS_OVERLAYALPHASURFACESNEG   = &h00000200

' DirectDraw FX Capability Flags

                                                                                               CONST  DDFXCAPS_BLTARITHSTRETCHY       = &h00000020
                                                                                               CONST  DDFXCAPS_BLTARITHSTRETCHYN      = &h00000010
                                                                                               CONST  DDFXCAPS_BLTMIRRORLEFTRIGHT     = &h00000040
                                                                                               CONST  DDFXCAPS_BLTMIRRORUPDOWN        = &h00000080
                                                                                               CONST  DDFXCAPS_BLTROTATION            = &h00000100
                                                                                               CONST  DDFXCAPS_BLTROTATION90          = &h00000200
                                                                                               CONST  DDFXCAPS_BLTSHRINKX             = &h00000400
                                                                                               CONST  DDFXCAPS_BLTSHRINKXN            = &h00000800
                                                                                               CONST  DDFXCAPS_BLTSHRINKY             = &h00001000
                                                                                               CONST  DDFXCAPS_BLTSHRINKYN            = &h00002000
                                                                                               CONST  DDFXCAPS_BLTSTRETCHX            = &h00004000
                                                                                               CONST  DDFXCAPS_BLTSTRETCHXN           = &h00008000
                                                                                               CONST  DDFXCAPS_BLTSTRETCHY            = &h00010000
                                                                                               CONST  DDFXCAPS_BLTSTRETCHYN           = &h00020000
                                                                                               CONST  DDFXCAPS_OVERLAYARITHSTRETCHY   = &h00040000
                                                                                               CONST  DDFXCAPS_OVERLAYARITHSTRETCHYN  = &h00000008
                                                                                               CONST  DDFXCAPS_OVERLAYSHRINKX         = &h00080000
                                                                                               CONST  DDFXCAPS_OVERLAYSHRINKXN        = &h00100000
                                                                                               CONST  DDFXCAPS_OVERLAYSHRINKY         = &h00200000
                                                                                               CONST  DDFXCAPS_OVERLAYSHRINKYN        = &h00400000
                                                                                               CONST  DDFXCAPS_OVERLAYSTRETCHX        = &h00800000
                                                                                               CONST  DDFXCAPS_OVERLAYSTRETCHXN       = &h01000000
                                                                                               CONST  DDFXCAPS_OVERLAYSTRETCHY        = &h02000000
                                                                                               CONST  DDFXCAPS_OVERLAYSTRETCHYN       = &h04000000
                                                                                               CONST  DDFXCAPS_OVERLAYMIRRORLEFTRIGHT = &h08000000
                                                                                               CONST  DDFXCAPS_OVERLAYMIRRORUPDOWN    = &h10000000
                                                                                               CONST  DDFXCAPS_BLTALPHA               = &h00000001
                                                                                               CONST  DDFXCAPS_BLTTRANSFORM           = &h00000002
                                                                                               CONST  DDFXCAPS_BLTFILTER              = DDFXCAPS_BLTARITHSTRETCHY
                                                                                               CONST  DDFXCAPS_OVERLAYALPHA           = &h00000004
                                                                                               CONST  DDFXCAPS_OVERLAYTRANSFORM       = &h20000000
                                                                                               CONST  DDFXCAPS_OVERLAYFILTER          = DDFXCAPS_OVERLAYARITHSTRETCHY

' DirectDraw Stereo View Capabilities

                                                                                               CONST  DDSVCAPS_RESERVED1              = &h00000001
                                                                                               CONST  DDSVCAPS_RESERVED2              = &h00000002
                                                                                               CONST  DDSVCAPS_RESERVED3              = &h00000004
                                                                                               CONST  DDSVCAPS_RESERVED4              = &h00000008
                                                                                               CONST  DDSVCAPS_STEREOSEQUENTIAL       = &h00000010

' DirectDrawPalette Capabilities

                                                                                               CONST  DDPCAPS_4BIT               = &h00000001
                                                                                               CONST  DDPCAPS_8BITENTRIES        = &h00000002
                                                                                               CONST  DDPCAPS_8BIT               = &h00000004
                                                                                               CONST  DDPCAPS_INITIALIZE         = &h00000008
                                                                                               CONST  DDPCAPS_PRIMARYSURFACE     = &h00000010
                                                                                               CONST  DDPCAPS_PRIMARYSURFACELEFT = &h00000020
                                                                                               CONST  DDPCAPS_ALLOW256           = &h00000040
                                                                                               CONST  DDPCAPS_VSYNC              = &h00000080
                                                                                               CONST  DDPCAPS_1BIT               = &h00000100
                                                                                               CONST  DDPCAPS_2BIT               = &h00000200
                                                                                               CONST  DDPCAPS_ALPHA              = &h00000400

' DirectDraw BitDepth Constants

                                                                                               CONST  DDBD_1  = &h00004000
                                                                                               CONST  DDBD_2  = &h00002000
                                                                                               CONST  DDBD_4  = &h00001000
                                                                                               CONST  DDBD_8  = &h00000800
                                                                                               CONST  DDBD_16 = &h00000400
                                                                                               CONST  DDBD_24 = &h00000200
                                                                                               CONST  DDBD_32 = &h00000100

' DirectDraw Set/Get Color Key Flags

                                                                                               CONST  DDCKEY_COLORSPACE  = &h00000001
                                                                                               CONST  DDCKEY_DESTBLT     = &h00000002
                                                                                               CONST  DDCKEY_DESTOVERLAY = &h00000004
                                                                                               CONST  DDCKEY_SRCBLT      = &h00000008
                                                                                               CONST  DDCKEY_SRCOVERLAY  = &h00000010

' DirectDraw Color Key Capability Flags

                                                                                               CONST  DDCKEYCAPS_DESTBLT                = &h00000001
                                                                                               CONST  DDCKEYCAPS_DESTBLTCLRSPACE        = &h00000002
                                                                                               CONST  DDCKEYCAPS_DESTBLTCLRSPACEYUV     = &h00000004
                                                                                               CONST  DDCKEYCAPS_DESTBLTYUV             = &h00000008
                                                                                               CONST  DDCKEYCAPS_DESTOVERLAY            = &h00000010
                                                                                               CONST  DDCKEYCAPS_DESTOVERLAYCLRSPACE    = &h00000020
                                                                                               CONST  DDCKEYCAPS_DESTOVERLAYCLRSPACEYUV = &h00000040
                                                                                               CONST  DDCKEYCAPS_DESTOVERLAYONEACTIVE   = &h00000080
                                                                                               CONST  DDCKEYCAPS_DESTOVERLAYYUV         = &h00000100
                                                                                               CONST  DDCKEYCAPS_SRCBLT                 = &h00000200
                                                                                               CONST  DDCKEYCAPS_SRCBLTCLRSPACE         = &h00000400
                                                                                               CONST  DDCKEYCAPS_SRCBLTCLRSPACEYUV      = &h00000800
                                                                                               CONST  DDCKEYCAPS_SRCBLTYUV              = &h00001000
                                                                                               CONST  DDCKEYCAPS_SRCOVERLAY             = &h00002000
                                                                                               CONST  DDCKEYCAPS_SRCOVERLAYCLRSPACE     = &h00004000
                                                                                               CONST  DDCKEYCAPS_SRCOVERLAYCLRSPACEYUV  = &h00008000
                                                                                               CONST  DDCKEYCAPS_SRCOVERLAYONEACTIVE    = &h00010000
                                                                                               CONST  DDCKEYCAPS_SRCOVERLAYYUV          = &h00020000
                                                                                               CONST  DDCKEYCAPS_NOCOSTOVERLAY          = &h00040000

' DirectDraw PixelFormat Flags

                                                                                               CONST  DDPF_ALPHAPIXELS       = &h00000001
                                                                                               CONST  DDPF_ALPHA             = &h00000002
                                                                                               CONST  DDPF_FOURCC            = &h00000004
                                                                                               CONST  DDPF_PALETTEINDEXED4   = &h00000008
                                                                                               CONST  DDPF_PALETTEINDEXEDTO8 = &h00000010
                                                                                               CONST  DDPF_PALETTEINDEXED8   = &h00000020
                                                                                               CONST  DDPF_RGB               = &h00000040
                                                                                               CONST  DDPF_COMPRESSED        = &h00000080
                                                                                               CONST  DDPF_RGBTOYUV          = &h00000100
                                                                                               CONST  DDPF_YUV               = &h00000200
                                                                                               CONST  DDPF_ZBUFFER           = &h00000400
                                                                                               CONST  DDPF_PALETTEINDEXED1   = &h00000800
                                                                                               CONST  DDPF_PALETTEINDEXED2   = &h00001000
                                                                                               CONST  DDPF_ZPIXELS           = &h00002000
                                                                                               CONST  DDPF_STENCILBUFFER     = &h00004000
                                                                                               CONST  DDPF_ALPHAPREMULT      = &h00008000
                                                                                               CONST  DDPF_LUMINANCE         = &h00020000
                                                                                               CONST  DDPF_BUMPLUMINANCE     = &h00040000
                                                                                               CONST  DDPF_BUMPDUDV          = &h00080000

' DirectDraw SetDisplayMode Flags

                                                                                               CONST  DDSDM_STANDARDVGAMODE  = &h00000001

' DirectDraw EnumDisplayModes Flags

                                                                                               CONST  DDEDM_REFRESHRATES     = &h00000001
                                                                                               CONST  DDEDM_STANDARDVGAMODES = &h00000002

' DirectDraw EnumSurfaces Flags

                                                                                               CONST  DDENUMSURFACES_ALL           = &h00000001
                                                                                               CONST  DDENUMSURFACES_MATCH         = &h00000002
                                                                                               CONST  DDENUMSURFACES_NOMATCH       = &h00000004
                                                                                               CONST  DDENUMSURFACES_CANBECREATED  = &h00000008
                                                                                               CONST  DDENUMSURFACES_DOESEXIST     = &h00000010

' DirectDraw SetCooperativeLevel Flags

                                                                                               CONST  DDSCL_FULLSCREEN          = &h00000001
                                                                                               CONST  DDSCL_ALLOWREBOOT         = &h00000002
                                                                                               CONST  DDSCL_NOWINDOWCHANGES     = &h00000004
                                                                                               CONST  DDSCL_NORMAL              = &h00000008
                                                                                               CONST  DDSCL_EXCLUSIVE           = &h00000010
                                                                                               CONST  DDSCL_ALLOWMODEX          = &h00000040
                                                                                               CONST  DDSCL_SETFOCUSWINDOW      = &h00000080
                                                                                               CONST  DDSCL_SETDEVICEWINDOW     = &h00000100
                                                                                               CONST  DDSCL_CREATEDEVICEWINDOW  = &h00000200
                                                                                               CONST  DDSCL_MULTITHREADED       = &h00000400
                                                                                               CONST  DDSCL_FPUSETUP            = &h00000800
                                                                                               CONST  DDSCL_FPUPRESERVE         = &h00001000

' DirectDraw Blt Flags

                                                                                               CONST  DDBLT_ALPHADEST                = &h00000001
                                                                                               CONST  DDBLT_ALPHADESTCONSTOVERRIDE   = &h00000002
                                                                                               CONST  DDBLT_ALPHADESTNEG             = &h00000004
                                                                                               CONST  DDBLT_ALPHADESTSURFACEOVERRIDE = &h00000008
                                                                                               CONST  DDBLT_ALPHAEDGEBLEND           = &h00000010
                                                                                               CONST  DDBLT_ALPHASRC                 = &h00000020
                                                                                               CONST  DDBLT_ALPHASRCCONSTOVERRIDE    = &h00000040
                                                                                               CONST  DDBLT_ALPHASRCNEG              = &h00000080
                                                                                               CONST  DDBLT_ALPHASRCSURFACEOVERRIDE  = &h00000100
                                                                                               CONST  DDBLT_ASYNC                    = &h00000200
                                                                                               CONST  DDBLT_COLORFILL                = &h00000400
                                                                                               CONST  DDBLT_DDFX                     = &h00000800
                                                                                               CONST  DDBLT_DDROPS                   = &h00001000
                                                                                               CONST  DDBLT_KEYDEST                  = &h00002000
                                                                                               CONST  DDBLT_KEYDESTOVERRIDE          = &h00004000
                                                                                               CONST  DDBLT_KEYSRC                   = &h00008000
                                                                                               CONST  DDBLT_KEYSRCOVERRIDE           = &h00010000
                                                                                               CONST  DDBLT_ROP                      = &h00020000
                                                                                               CONST  DDBLT_ROTATIONANGLE            = &h00040000
                                                                                               CONST  DDBLT_ZBUFFER                  = &h00080000
                                                                                               CONST  DDBLT_ZBUFFERDESTCONSTOVERRIDE = &h00100000
                                                                                               CONST  DDBLT_ZBUFFERDESTOVERRIDE      = &h00200000
                                                                                               CONST  DDBLT_ZBUFFERSRCCONSTOVERRIDE  = &h00400000
                                                                                               CONST  DDBLT_ZBUFFERSRCOVERRIDE       = &h00800000
                                                                                               CONST  DDBLT_WAIT                     = &h01000000
                                                                                               CONST  DDBLT_DEPTHFILL                = &h02000000
                                                                                               CONST  DDBLT_DONOTWAIT                = &h08000000

' BltFast Flags

                                                                                               CONST  DDBLTFAST_NOCOLORKEY   = &h00000000
                                                                                               CONST  DDBLTFAST_SRCCOLORKEY  = &h00000001
                                                                                               CONST  DDBLTFAST_DESTCOLORKEY = &h00000002
                                                                                               CONST  DDBLTFAST_WAIT         = &h00000010
                                                                                               CONST  DDBLTFAST_DONOTWAIT    = &h00000020

' Flip Flags

                                                                                               CONST  DDFLIP_WAIT      = &h00000001
                                                                                               CONST  DDFLIP_EVEN      = &h00000002
                                                                                               CONST  DDFLIP_ODD       = &h00000004
                                                                                               CONST  DDFLIP_NOVSYNC   = &h00000008
                                                                                               CONST  DDFLIP_INTERVAL2 = &h02000000
                                                                                               CONST  DDFLIP_INTERVAL3 = &h03000000
                                                                                               CONST  DDFLIP_INTERVAL4 = &h04000000
                                                                                               CONST  DDFLIP_STEREO    = &h00000010
                                                                                               CONST  DDFLIP_DONOTWAIT = &h00000020

' DirectDraw Surface Overlay Flags

                                                                                               CONST  DDOVER_ALPHADEST                = &h00000001
                                                                                               CONST  DDOVER_ALPHADESTCONSTOVERRIDE   = &h00000002
                                                                                               CONST  DDOVER_ALPHADESTNEG             = &h00000004
                                                                                               CONST  DDOVER_ALPHADESTSURFACEOVERRIDE = &h00000008
                                                                                               CONST  DDOVER_ALPHAEDGEBLEND           = &h00000010
                                                                                               CONST  DDOVER_ALPHASRC                 = &h00000020
                                                                                               CONST  DDOVER_ALPHASRCCONSTOVERRIDE    = &h00000040
                                                                                               CONST  DDOVER_ALPHASRCNEG              = &h00000080
                                                                                               CONST  DDOVER_ALPHASRCSURFACEOVERRIDE  = &h00000100
                                                                                               CONST  DDOVER_HIDE                     = &h00000200
                                                                                               CONST  DDOVER_KEYDEST                  = &h00000400
                                                                                               CONST  DDOVER_KEYDESTOVERRIDE          = &h00000800
                                                                                               CONST  DDOVER_KEYSRC                   = &h00001000
                                                                                               CONST  DDOVER_KEYSRCOVERRIDE           = &h00002000
                                                                                               CONST  DDOVER_SHOW                     = &h00004000
                                                                                               CONST  DDOVER_ADDDIRTYRECT             = &h00008000
                                                                                               CONST  DDOVER_REFRESHDIRTYRECTS        = &h00010000
                                                                                               CONST  DDOVER_REFRESHALL               = &h00020000
                                                                                               CONST  DDOVER_DDFX                     = &h00080000
                                                                                               CONST  DDOVER_AUTOFLIP                 = &h00100000
                                                                                               CONST  DDOVER_BOB                      = &h00200000
                                                                                               CONST  DDOVER_OVERRIDEBOBWEAVE         = &h00400000
                                                                                               CONST  DDOVER_INTERLEAVED              = &h00800000
                                                                                               CONST  DDOVER_BOBHARDWARE              = &h01000000
                                                                                               CONST  DDOVER_ARGBSCALEFACTORS         = &h02000000
                                                                                               CONST  DDOVER_DEGRADEARGBSCALING       = &h04000000

' DirectDrawSurface Lock Flags

                                                                                               CONST  DDLOCK_SURFACEMEMORYPTR  = &h00000000    ' default
                                                                                               CONST  DDLOCK_WAIT              = &h00000001
                                                                                               CONST  DDLOCK_EVENT             = &h00000002
                                                                                               CONST  DDLOCK_READONLY          = &h00000010
                                                                                               CONST  DDLOCK_WRITEONLY         = &h00000020
                                                                                               CONST  DDLOCK_NOSYSLOCK         = &h00000800
                                                                                               CONST  DDLOCK_NOOVERWRITE       = &h00001000
                                                                                               CONST  DDLOCK_DISCARDCONTENTS   = &h00002000
                                                                                               CONST  DDLOCK_OKTOSWAP          = &h00002000
                                                                                               CONST  DDLOCK_DONOTWAIT         = &h00004000

' DirectDrawSurface Blt FX Flags

                                                                                               CONST  DDBLTFX_ARITHSTRETCHY    = &h00000001
                                                                                               CONST  DDBLTFX_MIRRORLEFTRIGHT  = &h00000002
                                                                                               CONST  DDBLTFX_MIRRORUPDOWN     = &h00000004
                                                                                               CONST  DDBLTFX_NOTEARING        = &h00000008
                                                                                               CONST  DDBLTFX_ROTATE180        = &h00000010
                                                                                               CONST  DDBLTFX_ROTATE270        = &h00000020
                                                                                               CONST  DDBLTFX_ROTATE90         = &h00000040
                                                                                               CONST  DDBLTFX_ZBUFFERRANGE     = &h00000080
                                                                                               CONST  DDBLTFX_ZBUFFERBASEDEST  = &h00000100

' DirectDrawSurface Overlay FX Flags

                                                                                               CONST  DDOVERFX_ARITHSTRETCHY   = &h00000001
                                                                                               CONST  DDOVERFX_MIRRORLEFTRIGHT = &h00000002
                                                                                               CONST  DDOVERFX_MIRRORUPDOWN    = &h00000004

' Flags for dwDDFX member of DDSPRITEFX structure

                                                                                               CONST  DDSPRITEFX_AFFINETRANSFORM    = &h00000001
                                                                                               CONST  DDSPRITEFX_RGBASCALING        = &h00000002
                                                                                               CONST  DDSPRITEFX_DEGRADERGBASCALING = &h00000004
                                                                                               CONST  DDSPRITEFX_BILINEARFILTER     = &h00000008
                                                                                               CONST  DDSPRITEFX_BLURFILTER         = &h00000010
                                                                                               CONST  DDSPRITEFX_FLATFILTER         = &h00000020
                                                                                               CONST  DDSPRITEFX_DEGRADEFILTER      = &h00000040

' DirectDraw WaitForVerticalBlank Flags

                                                                                               CONST  DDWAITVB_BLOCKBEGIN      = &h00000001
                                                                                               CONST  DDWAITVB_BLOCKBEGINEVENT = &h00000002
                                                                                               CONST  DDWAITVB_BLOCKEND        = &h00000004

' DirectDraw GetFlipStatus Flags

                                                                                               CONST  DDGFS_CANFLIP    = &h00000001
                                                                                               CONST  DDGFS_ISFLIPDONE = &h00000002

' DirectDraw GetBltStatus Flags

                                                                                               CONST  DDGBS_CANBLT     = &h00000001
                                                                                               CONST  DDGBS_ISBLTDONE  = &h00000002

' DirectDraw EnumOverlayZOrder Flags

                                                                                               CONST  DDENUMOVERLAYZ_BACKTOFRONT = &h00000000
                                                                                               CONST  DDENUMOVERLAYZ_FRONTTOBACK = &h00000001

' DirectDraw UpdateOverlayZOrder Flags

                                                                                               CONST  DDOVERZ_SENDTOFRONT     = &h00000000
                                                                                               CONST  DDOVERZ_SENDTOBACK      = &h00000001
                                                                                               CONST  DDOVERZ_MOVEFORWARD     = &h00000002
                                                                                               CONST  DDOVERZ_MOVEBACKWARD    = &h00000003
                                                                                               CONST  DDOVERZ_INSERTINFRONTOF = &h00000004
                                                                                               CONST  DDOVERZ_INSERTINBACKOF  = &h00000005

' DirectDrawSurface SetPrivateData Constants

                                                                                               CONST  DDSPD_IUNKNOWNPOINTER   = &h00000001
                                                                                               CONST  DDSPD_VOLATILE          = &h00000002

' DDColorControl flags

                                                                                               CONST  DDCOLOR_BRIGHTNESS    = &h00000001
                                                                                               CONST  DDCOLOR_CONTRAST      = &h00000002
                                                                                               CONST  DDCOLOR_HUE           = &h00000004
                                                                                               CONST  DDCOLOR_SATURATION    = &h00000008
                                                                                               CONST  DDCOLOR_SHARPNESS     = &h00000010
                                                                                               CONST  DDCOLOR_GAMMA         = &h00000020
                                                                                               CONST  DDCOLOR_COLORENABLE   = &h00000040

' DirectDraw SetGammaRamp Flags

                                                                                               CONST  DDSGR_CALIBRATE = &h00000001

' DirectDraw StartModeTest Flags

                                                                                               CONST  DDSMT_ISTESTREQUIRED = &h00000001

' DirectDraw EvaluateMode Flags

                                                                                               CONST  DDEM_MODEPASSED      = &h00000001
                                                                                               CONST  DDEM_MODEFAILED      = &h00000002


' DirectDraw EnumCallback Return Values

                                                                                               CONST  DDENUMRET_CANCEL = 0
                                                                                               CONST  DDENUMRET_OK     = 1

' DirectDraw Return Codes


' DirectDraw Error Codes
                                                                                               CONST S_FALSE                 = &H00000001
                                                                                               CONST E_FAIL                  = &H80004005
                                                                                               CONST E_INVALIDARG            = &H80070057
                                                                                               CONST E_OUTOFMEMORY           = &H8007000E
                                                                                               CONST E_NOTIMPL               = &H80004001
                                                                                               CONST CO_E_NOTINITIALIZED     = &H800401F0


                                                                                               CONST DD_OK                               = &h0
                                                                                               CONST DD_FALSE                            = S_FALSE
                                                                                               CONST MAKE_DDHRESULT                      = &h088760000
                                                                                               CONST DDERR_ALREADYINITIALIZED            = MAKE_DDHRESULT + &h5
                                                                                               CONST DDERR_CANNOTATTACHSURFACE           = MAKE_DDHRESULT + &h10
                                                                                               CONST DDERR_CANNOTDETACHSURFACE           = MAKE_DDHRESULT + &h20
                                                                                               CONST DDERR_CURRENTLYNOTAVAIL             = MAKE_DDHRESULT + &h40
                                                                                               CONST DDERR_EXCEPTION                     = MAKE_DDHRESULT + &h55
                                                                                               CONST DDERR_GENERIC                       = E_FAIL
                                                                                               CONST DDERR_HEIGHTALIGN                   = MAKE_DDHRESULT + &h90
                                                                                               CONST DDERR_INCOMPATIBLEPRIMARY           = MAKE_DDHRESULT + &h95
                                                                                               CONST DDERR_INVALIDCAPS                   = MAKE_DDHRESULT + &h100
                                                                                               CONST DDERR_INVALIDCLIPLIST               = MAKE_DDHRESULT + &h110
                                                                                               CONST DDERR_INVALIDMODE                   = MAKE_DDHRESULT + &h120
                                                                                               CONST DDERR_INVALIDOBJECT                 = MAKE_DDHRESULT + &h130
                                                                                               CONST DDERR_INVALIDPARAMS                 = E_INVALIDARG
                                                                                               CONST DDERR_INVALIDPIXELFORMAT            = MAKE_DDHRESULT + &h145
                                                                                               CONST DDERR_INVALIDRECT                   = MAKE_DDHRESULT + &h150
                                                                                               CONST DDERR_LOCKEDSURFACES                = MAKE_DDHRESULT + &h160
                                                                                               CONST DDERR_NO3D                          = MAKE_DDHRESULT + &h170
                                                                                               CONST DDERR_NOALPHAHW                     = MAKE_DDHRESULT + &h180
                                                                                               CONST DDERR_NOCLIPLIST                    = MAKE_DDHRESULT + &h205
                                                                                               CONST DDERR_NOCOLORCONVHW                 = MAKE_DDHRESULT + &h210
                                                                                               CONST DDERR_NOCOOPERATIVELEVELSET         = MAKE_DDHRESULT + &h212
                                                                                               CONST DDERR_NOCOLORKEY                    = MAKE_DDHRESULT + &h215
                                                                                               CONST DDERR_NOCOLORKEYHW                  = MAKE_DDHRESULT + &h220
                                                                                               CONST DDERR_NODIRECTDRAWSUPPORT           = MAKE_DDHRESULT + &h222
                                                                                               CONST DDERR_NOEXCLUSIVEMODE               = MAKE_DDHRESULT + &h225
                                                                                               CONST DDERR_NOFLIPHW                      = MAKE_DDHRESULT + &h230
                                                                                               CONST DDERR_NOGDI                         = MAKE_DDHRESULT + &h240
                                                                                               CONST DDERR_NOMIRRORHW                    = MAKE_DDHRESULT + &h250
                                                                                               CONST DDERR_NOTFOUND                      = MAKE_DDHRESULT + &h255
                                                                                               CONST DDERR_NOOVERLAYHW                   = MAKE_DDHRESULT + &h260
                                                                                               CONST DDERR_OVERLAPPINGRECTS              = MAKE_DDHRESULT + &h270
                                                                                               CONST DDERR_NORASTEROPHW                  = MAKE_DDHRESULT + &h280
                                                                                               CONST DDERR_NOROTATIONHW                  = MAKE_DDHRESULT + &h290
                                                                                               CONST DDERR_NOSTRETCHHW                   = MAKE_DDHRESULT + &h310
                                                                                               CONST DDERR_NOT4BITCOLOR                  = MAKE_DDHRESULT + &h316
                                                                                               CONST DDERR_NOT4BITCOLORINDEX             = MAKE_DDHRESULT + &h317
                                                                                               CONST DDERR_NOT8BITCOLOR                  = MAKE_DDHRESULT + &h320
                                                                                               CONST DDERR_NOTEXTUREHW                   = MAKE_DDHRESULT + &h330
                                                                                               CONST DDERR_NOVSYNCHW                     = MAKE_DDHRESULT + &h335
                                                                                               CONST DDERR_NOZBUFFERHW                   = MAKE_DDHRESULT + &h340
                                                                                               CONST DDERR_NOZOVERLAYHW                  = MAKE_DDHRESULT + &h350
                                                                                               CONST DDERR_OUTOFCAPS                     = MAKE_DDHRESULT + &h360
                                                                                               CONST DDERR_OUTOFMEMORY                   = E_OUTOFMEMORY
                                                                                               CONST DDERR_OUTOFVIDEOMEMORY              = MAKE_DDHRESULT + &h380
                                                                                               CONST DDERR_OVERLAYCANTCLIP               = MAKE_DDHRESULT + &h382
                                                                                               CONST DDERR_OVERLAYCOLORKEYONLYONEACTIVE  = MAKE_DDHRESULT + &h384
                                                                                               CONST DDERR_PALETTEBUSY                   = MAKE_DDHRESULT + &h387
                                                                                               CONST DDERR_COLORKEYNOTSET                = MAKE_DDHRESULT + &h400
                                                                                               CONST DDERR_SURFACEALREADYATTACHED        = MAKE_DDHRESULT + &h410
                                                                                               CONST DDERR_SURFACEALREADYDEPENDENT       = MAKE_DDHRESULT + &h420
                                                                                               CONST DDERR_SURFACEBUSY                   = MAKE_DDHRESULT + &h430
                                                                                               CONST DDERR_CANTLOCKSURFACE               = MAKE_DDHRESULT + &h435
                                                                                               CONST DDERR_SURFACEISOBSCURED             = MAKE_DDHRESULT + &h440
                                                                                               CONST DDERR_SURFACELOST                   = MAKE_DDHRESULT + &h450
                                                                                               CONST DDERR_SURFACENOTATTACHED            = MAKE_DDHRESULT + &h460
                                                                                               CONST DDERR_TOOBIGHEIGHT                  = MAKE_DDHRESULT + &h470
                                                                                               CONST DDERR_TOOBIGSIZE                    = MAKE_DDHRESULT + &h480
                                                                                               CONST DDERR_TOOBIGWIDTH                   = MAKE_DDHRESULT + &h490
                                                                                               CONST DDERR_UNSUPPORTED                   = E_NOTIMPL
                                                                                               CONST DDERR_UNSUPPORTEDFORMAT             = MAKE_DDHRESULT + &h510
                                                                                               CONST DDERR_UNSUPPORTEDMASK               = MAKE_DDHRESULT + &h520
                                                                                               CONST DDERR_INVALIDSTREAM                 = MAKE_DDHRESULT + &h521
                                                                                               CONST DDERR_VERTICALBLANKINPROGRESS       = MAKE_DDHRESULT + &h537
                                                                                               CONST DDERR_WASSTILLDRAWING               = MAKE_DDHRESULT + &h540
                                                                                               CONST DDERR_XALIGN                        = MAKE_DDHRESULT + &h560
                                                                                               CONST DDERR_INVALIDDIRECTDRAWGUID         = MAKE_DDHRESULT + &h561
                                                                                               CONST DDERR_DIRECTDRAWALREADYCREATED      = MAKE_DDHRESULT + &h562
                                                                                               CONST DDERR_NODIRECTDRAWHW                = MAKE_DDHRESULT + &h563
                                                                                               CONST DDERR_PRIMARYSURFACEALREADYEXISTS   = MAKE_DDHRESULT + &h564
                                                                                               CONST DDERR_NOEMULATION                   = MAKE_DDHRESULT + &h565
                                                                                               CONST DDERR_REGIONTOOSMALL                = MAKE_DDHRESULT + &h566
                                                                                               CONST DDERR_CLIPPERISUSINGHWND            = MAKE_DDHRESULT + &h567
                                                                                               CONST DDERR_NOCLIPPERATTACHED             = MAKE_DDHRESULT + &h568
                                                                                               CONST DDERR_NOHWND                        = MAKE_DDHRESULT + &h569
                                                                                               CONST DDERR_HWNDSUBCLASSED                = MAKE_DDHRESULT + &h570
                                                                                               CONST DDERR_HWNDALREADYSET                = MAKE_DDHRESULT + &h571
                                                                                               CONST DDERR_NOPALETTEATTACHED             = MAKE_DDHRESULT + &h572
                                                                                               CONST DDERR_NOPALETTEHW                   = MAKE_DDHRESULT + &h573
                                                                                               CONST DDERR_BLTFASTCANTCLIP               = MAKE_DDHRESULT + &h574
                                                                                               CONST DDERR_NOBLTHW                       = MAKE_DDHRESULT + &h575
                                                                                               CONST DDERR_NODDROPSHW                    = MAKE_DDHRESULT + &h576
                                                                                               CONST DDERR_OVERLAYNOTVISIBLE             = MAKE_DDHRESULT + &h577
                                                                                               CONST DDERR_NOOVERLAYDEST                 = MAKE_DDHRESULT + &h578
                                                                                               CONST DDERR_INVALIDPOSITION               = MAKE_DDHRESULT + &h579
                                                                                               CONST DDERR_NOTAOVERLAYSURFACE            = MAKE_DDHRESULT + &h580
                                                                                               CONST DDERR_EXCLUSIVEMODEALREADYSET       = MAKE_DDHRESULT + &h581
                                                                                               CONST DDERR_NOTFLIPPABLE                  = MAKE_DDHRESULT + &h582
                                                                                               CONST DDERR_CANTDUPLICATE                 = MAKE_DDHRESULT + &h583
                                                                                               CONST DDERR_NOTLOCKED                     = MAKE_DDHRESULT + &h584
                                                                                               CONST DDERR_CANTCREATEDC                  = MAKE_DDHRESULT + &h585
                                                                                               CONST DDERR_NODC                          = MAKE_DDHRESULT + &h586
                                                                                               CONST DDERR_WRONGMODE                     = MAKE_DDHRESULT + &h587
                                                                                               CONST DDERR_IMPLICITLYCREATED             = MAKE_DDHRESULT + &h588
                                                                                               CONST DDERR_NOTPALETTIZED                 = MAKE_DDHRESULT + &h589
                                                                                               CONST DDERR_UNSUPPORTEDMODE               = MAKE_DDHRESULT + &h590
                                                                                               CONST DDERR_NOMIPMAPHW                    = MAKE_DDHRESULT + &h591
                                                                                               CONST DDERR_INVALIDSURFACETYPE            = MAKE_DDHRESULT + &h592
                                                                                               CONST DDERR_NOOPTIMIZEHW                  = MAKE_DDHRESULT + &h600
                                                                                               CONST DDERR_NOTLOADED                     = MAKE_DDHRESULT + &h601
                                                                                               CONST DDERR_NOFOCUSWINDOW                 = MAKE_DDHRESULT + &h602
                                                                                               CONST DDERR_DCALREADYCREATED              = MAKE_DDHRESULT + &h620
                                                                                               CONST DDERR_NONONLOCALVIDMEM              = MAKE_DDHRESULT + &h630
                                                                                               CONST DDERR_CANTPAGELOCK                  = MAKE_DDHRESULT + &h640
                                                                                               CONST DDERR_CANTPAGEUNLOCK                = MAKE_DDHRESULT + &h660
                                                                                               CONST DDERR_NOTPAGELOCKED                 = MAKE_DDHRESULT + &h680
                                                                                               CONST DDERR_MOREDATA                      = MAKE_DDHRESULT + &h690
                                                                                               CONST DDERR_EXPIRED                       = MAKE_DDHRESULT + &h691
                                                                                               CONST DDERR_VIDEONOTACTIVE                = MAKE_DDHRESULT + &h695
                                                                                               CONST DDERR_DEVICEDOESNTOWNSURFACE        = MAKE_DDHRESULT + &h699
                                                                                               CONST DDERR_NOTINITIALIZED                = CO_E_NOTINITIALIZED


                                                                                               SUB ReportDDError(Value AS HResult)
                                                                                                DIM Result AS STRING

                                                                                                SELECT CASE Value
                                                                                                CASE DD_OK
                                                                                                 Result = 'The request completed successfully"
                                                                                                CASE DDERR_ALREADYINITIALIZED
                                                                                                 Result = "This object is already initialized"
                                                                                                CASE DDERR_BLTFASTCANTCLIP
                                                                                                 Result = " if a clipper object is attached to the source surface passed into a BltFast call"
                                                                                                CASE DDERR_CANNOTATTACHSURFACE
                                                                                                 Result = "This surface can not be attached to the requested surface"
                                                                                                CASE DDERR_CANNOTDETACHSURFACE
                                                                                                 Result = "This surface can not be detached from the requested surface"
                                                                                                CASE DDERR_CANTCREATEDC
                                                                                                 Result = "Windows can not create any more DCs"
                                                                                                CASE DDERR_CANTDUPLICATE
                                                                                                 Result = "Cannot duplicate primary & 3D surfaces, or surfaces that are implicitly created"
                                                                                                CASE DDERR_CLIPPERISUSINGHWND
                                                                                                 Result = "An attempt was made to set a cliplist for a clipper object that is already monitoring an hwnd"
                                                                                                CASE DDERR_COLORKEYNOTSET
                                                                                                 Result = "No src color key specified for this operation"
                                                                                                CASE DDERR_CURRENTLYNOTAVAIL
                                                                                                 Result = "Support is currently not available"
                                                                                                CASE DDERR_DIRECTDRAWALREADYCREATED
                                                                                                 Result = "A DirectDraw object representing this driver has already been created for this process"
                                                                                                CASE DDERR_EXCEPTION
                                                                                                 Result = "An exception was encountered while performing the requested operation"
                                                                                                CASE DDERR_EXCLUSIVEMODEALREADYSET
                                                                                                 Result = "An attempt was made to set the cooperative level when it was already set to exclusive"
                                                                                                CASE DDERR_GENERIC
                                                                                                 Result = "Generic failure"
                                                                                                CASE DDERR_HEIGHTALIGN
                                                                                                 Result = "Height of rectangle provided is not a multiple of reqd alignment"
                                                                                                CASE DDERR_HWNDALREADYSET
                                                                                                 Result = "The CooperativeLevel HWND has already been set. It can not be reset while the process has surfaces or palettes created"
                                                                                                CASE DDERR_HWNDSUBCLASSED
                                                                                                 Result = "HWND used by DirectDraw CooperativeLevel has been subclassed, this prevents DirectDraw from restoring state"
                                                                                                CASE DDERR_IMPLICITLYCREATED
                                                                                                 Result = "This surface can not be restored because it is an implicitly created surface"
                                                                                                CASE DDERR_INCOMPATIBLEPRIMARY
                                                                                                 Result = "Unable to match primary surface creation request with existing primary surface"
                                                                                                CASE DDERR_INVALIDCAPS
                                                                                                 Result = "One or more of the caps bits passed to the callback are incorrect"
                                                                                                CASE DDERR_INVALIDCLIPLIST
                                                                                                 Result = "DirectDraw does not support the provided cliplist"
                                                                                                CASE DDERR_INVALIDDIRECTDRAWGUID
                                                                                                 Result = "The GUID passed to DirectDrawCreate is not a valid DirectDraw driver identifier"
                                                                                                CASE DDERR_INVALIDMODE
                                                                                                 Result = "DirectDraw does not support the requested mode"
                                                                                                CASE DDERR_INVALIDOBJECT
                                                                                                 Result = "DirectDraw received a pointer that was an invalid DIRECTDRAW object"
                                                                                                CASE DDERR_INVALIDPARAMS
                                                                                                 Result = "One or more of the parameters passed to the function are incorrect"
                                                                                                CASE DDERR_INVALIDPIXELFORMAT
                                                                                                 Result = "The pixel format was invalid as specified"
                                                                                                CASE DDERR_INVALIDPOSITION
                                                                                                 Result = "Returned when the position of the overlay on the destination is no longer legal for that destination"
                                                                                                CASE DDERR_INVALIDRECT
                                                                                                 Result = "Rectangle provided was invalid"
                                                                                                CASE DDERR_LOCKEDSURFACES
                                                                                                 Result = "Operation could not be carried out because one or more surfaces are locked"
                                                                                                CASE DDERR_NO3D
                                                                                                 Result = "There is no 3D present"
                                                                                                CASE DDERR_NOALPHAHW
                                                                                                 Result = "Operation could not be carried out because there is no alpha accleration hardware present or available"
                                                                                                CASE DDERR_NOBLTHW
                                                                                                 Result = "No blitter hardware present"
                                                                                                CASE DDERR_NOCLIPLIST
                                                                                                 Result = "No cliplist available"
                                                                                                CASE DDERR_NOCLIPPERATTACHED
                                                                                                 Result = "No clipper object attached to surface object"
                                                                                                CASE DDERR_NOCOLORCONVHW
                                                                                                 Result = "Operation could not be carried out because there is no color conversion hardware present or available"
                                                                                                CASE DDERR_NOCOLORKEY
                                                                                                 Result = "Surface does not currently have a color key"
                                                                                                CASE DDERR_NOCOLORKEYHW
                                                                                                 Result = "Operation could not be carried out because there is no hardware support of the destination color key"
                                                                                                CASE DDERR_NOCOOPERATIVELEVELSET
                                                                                                 Result = "Create function called without DirectDraw object method SetCooperativeLevel being called"
                                                                                                CASE DDERR_NODC
                                                                                                 Result = "No DC was ever created for this surface"
                                                                                                CASE DDERR_NODDROPSHW
                                                                                                 Result = "No DirectDraw ROP hardware"
                                                                                                CASE DDERR_NODIRECTDRAWHW
                                                                                                 Result = "A hardware-only DirectDraw object creation was attempted but the driver did not support any hardware"
                                                                                                CASE DDERR_NOEMULATION
                                                                                                 Result = "Software emulation not available"
                                                                                                CASE DDERR_NOEXCLUSIVEMODE
                                                                                                 Result = "Operation requires the application to have exclusive mode but the application does not have exclusive mode"
                                                                                                CASE DDERR_NOFLIPHW
                                                                                                 Result = "Flipping visible surfaces is not supported"
                                                                                                CASE DDERR_NOGDI
                                                                                                 Result = "There is no GDI present"
                                                                                                CASE DDERR_NOHWND
                                                                                                 Result = "Clipper notification requires an HWND or no HWND has previously been set as the CooperativeLevel HWND"
                                                                                                CASE DDERR_NOMIRRORHW
                                                                                                 Result = "Operation could not be carried out because there is no hardware present or available"
                                                                                                CASE DDERR_NOOVERLAYDEST
                                                                                                 Result = "Returned when GetOverlayPosition is called on an overlay that UpdateOverlay has never been called on to establish a destination"
                                                                                                CASE DDERR_NOOVERLAYHW
                                                                                                 Result = "Operation could not be carried out because there is no overlay hardware present or available"
                                                                                                CASE DDERR_NOPALETTEATTACHED
                                                                                                 Result = "No palette object attached to this surface"
                                                                                                CASE DDERR_NOPALETTEHW
                                                                                                 Result = "No hardware support for 16 or 256 color palettes"
                                                                                                CASE DDERR_NORASTEROPHW
                                                                                                 Result = "Operation could not be carried out because there is no appropriate raster op hardware present or available"
                                                                                                CASE DDERR_NOROTATIONHW
                                                                                                 Result = "Operation could not be carried out because there is no rotation hardware present or available"
                                                                                                CASE DDERR_NOSTRETCHHW
                                                                                                 Result = "Operation could not be carried out because there is no hardware support for stretching"
                                                                                                CASE DDERR_NOT4BITCOLOR
                                                                                                 Result = "DirectDrawSurface is not in 4 bit color palette and the requested operation requires 4 bit color palette"
                                                                                                CASE DDERR_NOT4BITCOLORINDEX
                                                                                                 Result = "DirectDrawSurface is not in 4 bit color index palette and the requested operation requires 4 bit color index palette"
                                                                                                CASE DDERR_NOT8BITCOLOR
                                                                                                 Result = "DirectDrawSurface is not in 8 bit color mode and the requested operation requires 8 bit color"
                                                                                                CASE DDERR_NOTAOVERLAYSURFACE
                                                                                                 Result = "Returned when an overlay member is called for a non-overlay surface"
                                                                                                CASE DDERR_NOTEXTUREHW
                                                                                                 Result = "Operation could not be carried out because there is no texture mapping hardware present or available"
                                                                                                CASE DDERR_NOTFLIPPABLE
                                                                                                 Result = "An attempt has been made to flip a surface that is not flippable"
                                                                                                CASE DDERR_NOTFOUND
                                                                                                 Result = "Requested item was not found"
                                                                                                CASE DDERR_NOTLOCKED
                                                                                                 Result = "Surface was not locked.  An attempt to unlock a surface that was not locked at all, or by this process, has been attempted"
                                                                                                CASE DDERR_NOTPALETTIZED
                                                                                                 Result = "The surface being used is not a palette-based surface"
                                                                                                CASE DDERR_NOVSYNCHW
                                                                                                 Result = "Operation could not be carried out because there is no hardware support for vertical blank synchronized operations"
                                                                                                CASE DDERR_NOZBUFFERHW
                                                                                                 Result = "Operation could not be carried out because there is no hardware support for zbuffer blitting"
                                                                                                CASE DDERR_NOZOVERLAYHW
                                                                                                 Result = "Overlay surfaces could not be z layered based on their BltOrder because the hardware does not support z layering of overlays"
                                                                                                CASE DDERR_OUTOFCAPS
                                                                                                 Result = "The hardware needed for the requested operation has already been allocated"
                                                                                                CASE DDERR_OUTOFMEMORY
                                                                                                 Result = "DirectDraw does not have enough memory to perform the operation"
                                                                                                CASE DDERR_OUTOFVIDEOMEMORY
                                                                                                 Result = "DirectDraw does not have enough memory to perform the operation"
                                                                                                CASE DDERR_OVERLAYCANTCLIP
                                                                                                 Result = "The hardware does not support clipped overlays"
                                                                                                CASE DDERR_OVERLAYCOLORKEYONLYONEACTIVE
                                                                                                 Result = "Can only have ony color key active at one time for overlays"
                                                                                                CASE DDERR_OVERLAYNOTVISIBLE
                                                                                                 Result = "Returned when GetOverlayPosition is called on a hidden overlay"
                                                                                                CASE DDERR_PALETTEBUSY
                                                                                                 Result = "Access to this palette is being refused because the palette is already locked by another thread"
                                                                                                CASE DDERR_PRIMARYSURFACEALREADYEXISTS
                                                                                                 Result = "This process already has created a primary surface"
                                                                                                CASE DDERR_REGIONTOOSMALL
                                                                                                 Result = "Region passed to Clipper::GetClipList is too small"
                                                                                                CASE DDERR_SURFACEALREADYATTACHED
                                                                                                 Result = "This surface is already attached to the surface it is being attached to"
                                                                                                CASE DDERR_SURFACEALREADYDEPENDENT
                                                                                                 Result = "This surface is already a dependency of the surface it is being made a dependency of"
                                                                                                CASE DDERR_SURFACEBUSY
                                                                                                 Result = "Access to this surface is being refused because the surface is already locked by another thread"
                                                                                                CASE DDERR_SURFACEISOBSCURED
                                                                                                 Result = "Access to surface refused because the surface is obscured"
                                                                                                CASE DDERR_SURFACELOST
                                                                                                 Result = "Access to this surface is being refused because the surface memory is gone. The DirectDrawSurface object representing this surface should have Restore called on it"
                                                                                                CASE DDERR_SURFACENOTATTACHED
                                                                                                 Result = "The requested surface is not attached"
                                                                                                CASE DDERR_TOOBIGHEIGHT
                                                                                                 Result = "Height requested by DirectDraw is too large"
                                                                                                CASE DDERR_TOOBIGSIZE
                                                                                                 Result = "Size requested by DirectDraw is too large, but the individual height and width are OK"
                                                                                                CASE DDERR_TOOBIGWIDTH
                                                                                                 Result = "Width requested by DirectDraw is too large"
                                                                                                CASE DDERR_UNSUPPORTED
                                                                                                 Result = "Action not supported"
                                                                                                CASE DDERR_UNSUPPORTEDFORMAT
                                                                                                 Result = "FOURCC format requested is unsupported by DirectDraw"
                                                                                                CASE DDERR_UNSUPPORTEDMASK
                                                                                                 Result = "Bitmask in the pixel format requested is unsupported by DirectDraw"
                                                                                                CASE DDERR_VERTICALBLANKINPROGRESS
                                                                                                 Result = "Vertical blank is in progress"
                                                                                                CASE DDERR_WASSTILLDRAWING
                                                                                                 Result = "Informs DirectDraw that the previous Blt which is transfering information to or from this Surface is incomplete"
                                                                                                CASE DDERR_WRONGMODE
                                                                                                 Result = "This surface can not be restored because it was created in a different mode"
                                                                                                CASE DDERR_XALIGN
                                                                                                 Result = "Rectangle provided was not horizontally aligned on required boundary"
                                                                                                CASE DDERR_OVERLAPPINGRECTS
                                                                                                 Result = "Operation could not be carried out because the source and destination rectangles are on the same surface and overlap each other"
                                                                                                CASE DDERR_INVALIDSTREAM
                                                                                                 Result = "The specified stream contains invalid data"
                                                                                                CASE DDERR_UNSUPPORTEDMODE
                                                                                                 Result = "The display is currently in an unsupported mode"
                                                                                                CASE DDERR_NOMIPMAPHW
                                                                                                 Result = "Operation could not be carried out because there is no mip-map texture mapping hardware present or available"
                                                                                                CASE DDERR_INVALIDSURFACETYPE
                                                                                                 Result = "The requested action could not be performed because the surface was of the wrong type"
                                                                                                CASE DDERR_NOOPTIMIZEHW
                                                                                                 Result = "Device does not support optimized surfaces, therefore no video memory optimized surfaces"
                                                                                                CASE DDERR_NOTLOADED
                                                                                                 Result = "Surface is an optimized surface, but has not yet been allocated any memory"
                                                                                                CASE DDERR_NOFOCUSWINDOW
                                                                                                 Result = "Attempt was made to create or set a device window without first setting the focus window"
                                                                                                CASE DDERR_DCALREADYCREATED
                                                                                                 Result = "A DC has already been returned for this surface. Only one DC can be retrieved per surface"
                                                                                                CASE DDERR_NONONLOCALVIDMEM
                                                                                                 Result = "An attempt was made to allocate non-local video memory from a device that does not support non-local video memory"
                                                                                                CASE DDERR_CANTPAGELOCK
                                                                                                 Result = "The attempt to page lock a surface failed"
                                                                                                CASE DDERR_CANTPAGEUNLOCK
                                                                                                 Result = "The attempt to page unlock a surface failed"
                                                                                                CASE DDERR_NOTPAGELOCKED
                                                                                                 Result = "An attempt was made to page unlock a surface with no outstanding page locks"
                                                                                                CASE DDERR_MOREDATA
                                                                                                 Result = "There is more data available than the specified buffer size could hold"
                                                                                                CASE DDERR_EXPIRED
                                                                                                 Result = "The data has expired and is therefore no longer valid"
                                                                                                CASE DDERR_VIDEONOTACTIVE
                                                                                                 Result = "The video port is not active"
                                                                                                CASE DDERR_DEVICEDOESNTOWNSURFACE
                                                                                                 Result = "Surfaces created by one direct draw device cannot be used directly by another direct draw device"
                                                                                                CASE DDERR_NOTINITIALIZED
                                                                                                 Result = "An attempt was made to invoke an interface member of a DirectDraw object created by CoCreateInstance() before it was initialized"
                                                                                                CASE ELSE
                                                                                                 Result = "Unrecognized Error"
                                                                                                END SELECT
                                                                                                SHOWMESSAGE Result
                                                                                               END SUB


                                                                                               REGSTR_KEY_DDHW_DESCRIPTION = "Description"
                                                                                               REGSTR_KEY_DDHW_DRIVERNAME  = "DriverName"
                                                                                               REGSTR_PATH_DDHW            = "Hardware\DirectDrawDrivers"
                                                                                               DDCREATE_HARDWAREONLY       = &h00000001
                                                                                               DDCREATE_EMULATIONONLY      = &h00000002
掌柜推荐
 
 
 
 
 
 
 
 
 
 
 
 
© Wed 2024-4-24  Guidance Laboratory Inc.
Email:webmaster1g.yi.org Hits:0 Last modified:2013-06-19 07:53:34