Original post from Rbraz, taken from the ezboard forum
This is a code that I'm using to limit the max fps in C++/OGL and now converted it to FB, it use a high performance counter (QueryPerformanceCounter) and frequency performance (QueryPerformanceFrequency) to limit the max. frame rate. Feel free to use it in your next productions

'----------------------
' FPS Limiter
'----------------------
' by Rbraz - 2006
'----------------------
Option Explicit
' Includes
#Include Once "windows.bi"
'Sub Routines
Declare Sub FPS_Count()
'FPS Counter
Dim Shared iFPS, bSettime,iSecStart,iFrameCount,iFrameStart as integer
'--------------------------------------------------
Const MAX_FPS = 60 'Max FPS Desired
Dim Freq as LARGE_INTEGER
Dim cTimer1 as LARGE_INTEGER
Dim cTimer2 as LARGE_INTEGER
Dim Interval as double
'--------------------------------------------------
QueryPerformanceFrequency(@Freq) 'Get Frequency
Interval = CDBL(Freq.QuadPart) / CDBL(MAX_FPS) 'Calculate interval based on MAX_FPS and Frequency
'Main Loop
While Inkey$() <> Chr$( 27 )
QueryPerformanceCounter(@cTimer2)
if(cTimer2.QuadPart >= cTimer1.QuadPart + Interval) then
QueryPerformanceCounter(@cTimer1)
locate 8,30
print "Desired FPS: " & MAX_FPS
locate 10,30
print "Current FPS: " & iFPS
FPS_Count()
end if
Wend
'End Main
Sub FPS_Count()
If bSettime = 1 then
iSecStart = Timer() * 1000.0
iFrameStart = iFrameCount
bSettime = 0
EndIf
If (Timer()*1000.0) >= iSecStart + 1000 then
iFPS = iFrameCount - iFrameStart
bSettime = 1
EndIf
iFrameCount = iFrameCount + 1
End Sub
5H0CKW4VE
I may well pinch this, will credit you of course.. Thanks Rbraz 