Timing API Calls

BlitzMax Forums/BlitzMax Programming/Timing API Calls

WiredWorm(Posted 2007) [#1]
Hello there,

There are 3 API calls that I want to make use of within BlitzMax. I've got one of them working but for some reason the others fail at compile-time.

Public Declare Function timeBeginPeriod Lib "winmm.dll" (ByVal uPeriod As Long) As Long

Above you can see the declaration as it would appear in VB. I've convert this to read:

Extern "Os"
Function timeBeginPeriod:Long(uPeriod:Long)
End Extern

But for some reason when I then make call like this: timeBeginPeriod(1) it fails at compile time.

Other declarations referencing WinMM.dll seem to work just fine. I've also validated the function name is correct by using the Depends.exe utility.

Any clues anyone?

Cheers

Pete


fredborg(Posted 2007) [#2]
The easiest way to check up on stuff like this is taking a look at the msdn reference:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/multimed/htm/_win32_timebeginperiod.asp
As you can see you should use Int and not Long.


WiredWorm(Posted 2007) [#3]
Thanks fredborg - that fixed the problem - and the URL you've posted for API documentation will be really helpful in the future.

Thanks :D