[solved]Any XP user here ?

Windows specific questions.
Post Reply
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

[solved]Any XP user here ?

Post by D.J.Peters »

If any XP user here can you report min: max: from timeGetDevCaps() please ?
(I can't test it self I'm not at home ATM)

Joshy

Code: Select all

#ifdef __FB_WIN32__
 #include "windows.bi"
 #include "win/mmsystem.bi"
#else
 #error 666, sorry Windows only test !
#endif

dim shared as TIMECAPS gTimeCaps

sub _moduleInit constructor
  print "module()"
  timeGetDevCaps(@gTimeCaps,sizeof(TIMECAPS))
  print "min: " & gTimeCaps.wPeriodMin & " max: " & gTimeCaps.wPeriodMax
  timeBeginPeriod(gTimeCaps.wPeriodMin)
end sub

sub _moduleExit destructor
  print "module~"
  timeEndPeriod(gTimeCaps.wPeriodMin)
  beep
  sleep 3000,1
end sub

sub SleepMS(byval ms as ulong)
  static as ulong rest=0
  if ms<gTimeCaps.wPeriodMin then
    ms = gTimeCaps.wPeriodMin
  elseif ms>gTimeCaps.wPeriodMax then
    ms = gTimeCaps.wPeriodMax
  end if
  ' if on XP min value >1 eg. 15 store the remainder for next SleepMS() call
  ms += rest : rest = ms mod gTimeCaps.wPeriodMin
  SleepEx(ms, FALSE)
end sub


'
' main
'
screenres 640,480,8,2
screenset 1,0
const as single radius = 30.0f
dim as single x = -radius
while inkey()=""
  cls
  circle(x,240),radius,1,,,,F
  flip
  SleepMS(1000/(640+2*radius))
  x+=1:if x-radius>639 then x=-radius
wend
Last edited by D.J.Peters on Nov 06, 2020 21:15, edited 1 time in total.
hhr
Posts: 208
Joined: Nov 29, 2019 10:41

Re: Any XP user here ?

Post by hhr »

min: 1 max: 1000000
Last edited by hhr on Nov 07, 2020 5:37, edited 1 time in total.
grindstone
Posts: 862
Joined: May 05, 2015 5:35
Location: Germany

Re: Any XP user here ?

Post by grindstone »

Working on XP (as main OS) without any problems.

module()
min: 1 max: 1000000
D.J.Peters
Posts: 8586
Joined: May 28, 2005 3:28
Contact:

Re: Any XP user here ?

Post by D.J.Peters »

Thanks for the report.

Joshy
antarman
Posts: 81
Joined: Jun 12, 2006 9:27
Location: Russia, Krasnodar

Re: [solved]Any XP user here ?

Post by antarman »

module()
min: 1 max: 1000000
work is well.
Post Reply