January 1, 2005

WinTask - StrFromTimeInterval

'
' StrFromTimeInterval
'
' Author: Joe Strazzere
'

'External("shlwapi.dll","StrFromTimeIntervalA",pszOut,cchMax,dwTimeMS,digits)
'pszOut
'[out] Pointer to a character buffer that receives the converted string.
'cchMax
'[in] Size of pszOut, in characters. If cchMax is set to zero,
'     StrFromTimeInterval will return the minimum size of the character buffer
'     needed to hold the converted string. In this case, pszOut will not contain the converted string.
'dwTimeMS
'[in] Time interval, in milliseconds.
'digits
'[in] Maximum number of digits to be represented in pszOut. Some examples are:
' dwTimeMS digits pszOut
' 34000    3      34 sec
' 34000    2      34 sec
' 34000    1      30 sec
' 74000    3      1 min 14 sec
' 74000    2      1 min 10 sec
' 74000    1      1 min

a$="                                        "
ret=External("shlwapi.dll","StrFromTimeIntervalA",a$,40,74000,3)
msgbox(a$)
ret=External("shlwapi.dll","StrFromTimeIntervalA",a$,40,74000,2)
msgbox(a$)
ret=External("shlwapi.dll","StrFromTimeIntervalA",a$,40,74000,1)
msgbox(a$)

StartTimer(1)
pause 3 secs
i=Timer(1)*10
ret=External("shlwapi.dll","StrFromTimeIntervalA",a$,40,i,3)
msgbox(Str$(i)+" milliseconds = "+a$)
StopTimer(1)