@Trinity
So I ran the Windows Timestamp Project! G_Kernel which set the timer to 1.000 ms
That is using a sledgehammer to crack a nut.
Here is your opening post 'tweaked' with 'StartHiResSleep' - flashing like a treat.<smile>
Code: Select all
#include "windows.bi"
#include "win/mmsystem.bi"
#include "fbgfx.bi"
Using FB ' namespace
#Macro StartHiResSleep
Scope
Dim As TIMECAPS tc
TimeGetDevCaps( @tc, Sizeof(tc) )
TimeBeginPeriod(tc.wPeriodMin)
End Scope
Sleep (16,1) ' Tests have shown that the new resolution will not 'bite' until next 'old' tick
#EndMacro
StartHiResSleep
Dim As Integer W,H
Screeninfo W,H
W=W-200 : H = H-200
Screenres W,H,,, GFX_NO_FRAME
Width W\8, H\16
Declare Function Getflash() As Integer
Dim As Integer foo
Do
Locate 8,20 : foo=Getflash
Locate (10,20,1) : Print "total return: " & foo
If( foo > 255 ) Then
Locate (12,20,1) : Print "extended code: " & (foo And &hff)
Locate (14,20,1) : Print "regular code: " & (foo Shr 8)
Else
Locate (12,20,1) : Print "regular code: " & (foo)
End If
Print
Loop Until foo = 27
Function Getflash() As Integer
#define mk(a,b) a Or b Shl 8
Dim As String s,c,i
Static As Long ctr
Dim As Integer p=Pos,cl=Csrlin
While Len(Inkey):Wend
Do
i=Inkey
ctr+=1
Locate cl,p
If ctr Mod 200=0 Then c ="__"
If ctr Mod 400=0 Then c= " ":ctr=0
Print c
If Len(i) Then Cls: Return mk(i[0],i[1])
Sleep 1,1
Loop
End Function
The System clock has it's resolution changed to 1ms. This is system wide change but will only persist for as long as the process which changes it continues. As soon as your code terminates the System clock will return to 15.625ms.
This what my TimerRes application tells me whilst your code is running.
Ignore the Title Bar - my system has been tweaked with regard the buttons - my windows are usually much wider.
I shall post a download link to TimerRes shortly. It is better than the SysInternals offering because it does more than monitor the resolution.
Trinity wrote:I am completely new to FB
So am I - came here in January. It is a cracking BASIC but can be a right PITA sometimes.