  uses console
  
  extern lib "Ole32.dll"
  sys CoInitialize(void* pvReserved)
  sys CoUninitialize()

  extern lib "Ddraw.dll"
  sys DirectDrawCreate(sys lpGUID, sys lplpDD, sys pUnkOuter)
  
  #define IDirectDraw_Offset_To_GetMonitorFrequency_Method_Ptr 60
  
  sys lpDD1 = 0 
  sys freq = 0
  
  CoInitialize 0
  if not DirectDrawCreate(0, @lpDD1, 0) then
    sys a=*(*lpDD1+IDirectDraw_Offset_To_GetMonitorFrequency_Method_Ptr)
    call a(lpDD1, @freq)
    print "Your monitor's current frequency is " + freq + "Hz." + cr
  else
    print "Failed to create DirectDraw1 surface. Monitor frequency unknown." + cr
  end if
  
  CoUninitialize
  
  getkey





