  sys CoInitialize lib "Ole32.dll" (sys pvReserved)
  sys CoUninitialize lib "Ole32.dll" ()
  sys DirectDrawCreate lib "Ddraw.dll" (sys lpGUID, lplpDD, pUnkOuter)
  dword freq
  typedef dword DWORD,HRESULT,ULONG

'https://github.com/Alexpux/mingw-w64/blob/master/mingw-w64-headers/direct-x/include/ddraw.h#L1760
extern virtual
class DirectDraw7
/*00*/    ! QueryInterface'(REFIID riid, void** ppvObject)
/*01*/    ! AddRef'()
/*02*/    ! Release'()
          /*** IDirectDraw7 methods ***/
          'all returning HRESULT
/*03*/    ! Compact'()
/*04*/    ! CreateClipper'(DWORD dwFlags, LPDIRECTDRAWCLIPPER *lplpDDClipper, IUnknown *pUnkOuter)
/*05*/    ! CreatePalette'(DWORD dwFlags, LPPALETTEENTRY lpColorTable, LPDIRECTDRAWPALETTE *lplpDDPalette, IUnknown *pUnkOuter)
/*06*/    ! CreateSurface'(LPDDSURFACEDESC2 lpDDSurfaceDesc, LPDIRECTDRAWSURFACE7 *lplpDDSurface, IUnknown *pUnkOuter)
/*07*/    ! DuplicateSurface'(LPDIRECTDRAWSURFACE7 lpDDSurface, LPDIRECTDRAWSURFACE7 *lplpDupDDSurface)
/*08*/    ! EnumDisplayModes'(DWORD dwFlags, LPDDSURFACEDESC2 lpDDSurfaceDesc, LPVOID lpContext, LPDDENUMMODESCALLBACK2 lpEnumModesCallback)
/*09*/    ! EnumSurfaces'(DWORD dwFlags, LPDDSURFACEDESC2 lpDDSD, LPVOID lpContext, LPDDENUMSURFACESCALLBACK7 lpEnumSurfacesCallback)
/*10*/    ! FlipToGDISurface'()
/*11*/    ! GetCaps'(LPDDCAPS lpDDDriverCaps, LPDDCAPS lpDDHELCaps)
/*12*/    ! GetDisplayMode'(LPDDSURFACEDESC2 lpDDSurfaceDesc)
/*13*/    ! GetFourCCCodes'(LPDWORD lpNumCodes, LPDWORD lpCodes)
/*14*/    ! GetGDISurface'(LPDIRECTDRAWSURFACE7 *lplpGDIDDSurface)
/*15*/    ! GetMonitorFrequency'(LPDWORD lpdwFrequency)
/*16*/    ! GetScanLine'(LPDWORD lpdwScanLine)
/*17*/    ! GetVerticalBlankStatus'(BOOL *lpbIsInVB)
/*18*/    ! Initialize'(GUID *lpGUID)
/*19*/    ! RestoreDisplayMode'()
/*20*/    ! SetCooperativeLevel'(HWND hWnd, DWORD dwFlags)
/*21*/    ! SetDisplayMode'(DWORD dwWidth, DWORD dwHeight, DWORD dwBPP, DWORD dwRefreshRate, DWORD dwFlags)
/*22*/    ! WaitForVerticalBlank'(DWORD dwFlags, HANDLE hEvent)
/*23*/    ! GetAvailableVidMem'(LPDDSCAPS2 lpDDCaps, LPDWORD lpdwTotal, LPDWORD lpdwFree)
/*24*/    ! GetSurfaceFromDC'(HDC hdc, LPDIRECTDRAWSURFACE7 *pSurf)
/*25*/    ! RestoreAllSurfaces'()
/*26*/    ! TestCooperativeLevel'()
/*27*/    ! GetDeviceIdentifier'(LPDDDEVICEIDENTIFIER2 pDDDI, DWORD dwFlags)
/*28*/    ! StartModeTest'(LPSIZE pModes, DWORD dwNumModes, DWORD dwFlags)
/*29*/    ! EvaluateMode'(DWORD dwFlags, DWORD  *pTimeout)
end class
end extern

#recordof DirectDraw7

  
  CoInitialize 0
  
  DirectDraw7 * DD1
  if not DirectDrawCreate(0, @@DD1, 0)
    'DD1.GetMonitorFrequency(@freq)
    'calling by function ordinal
    sys vf[] at (sys)DD1
    indexbase 0
    call vf[15](@DD1,@freq)
    print ("Your monitor's current frequency is " freq "Hz.")
    DD1.Release
  else
    print ("Failed to create DirectDraw1 surface. Monitor frequency unknown.")
  end if
  
  CoUninitialize






