Contents Index Topic Contents | ||
Previous Topic: StrFormatByteSize Next Topic: StrIsIntlEqual |
StrFromTimeInterval
int StrFromTimeInterval( LPSTR pszOut, UINT cchMax, DWORD dwTimeMS, int digits );Converts a given time interval, in milliseconds, to a string.
- Returns the number of characters in the buffer, not including the null terminator.
- pszOut
- Address of a character buffer that receives the converted string.
- cchMax
- Size of pszOut, in characters.
- dwTimeMS
- Time interval in milliseconds.
- digits
- Minimum number of digits to be converted.
Example:
#include <windows.h> #include <iostream.h> #include "Shlwapi.h" void main( void ) { char TimeString[256]; char *pszOut; pszOut = TimeString; cout << "The return value from the call to" << "\nthe function StrFromTimeInterval will" << "\nreturn the number of elements in the buffer: " << endl; cout << "\nThe return from StrFromTimeInterval is " << StrFromTimeInterval(pszOut,30, 34000,30); cout << "\nThe contents of the TimeString Buffer " << pszOut << endl; cout << "The return from StrFromTimeInterval is " << StrFromTimeInterval(pszOut,30, 74000,3); cout << "\nThe contents of the TimeString Buffer " << pszOut << endl; cout << "The return from StrFromTimeInterval is " << StrFromTimeInterval(pszOut,30, 74000,2); cout << "\nThe contents of the TimeString Buffer " << pszOut << endl; cout << "The return from StrFromTimeInterval is " << StrFromTimeInterval(pszOut,30, 74000,1) << "\nThe contents of the TimeString Buffer " << pszOut << endl; } OUTPUT: - - - - - The return value from the call to the function StrFromTimeInterval will return the number of elements in the buffer: The return from StrFromTimeInterval is 7 The contents of the TimeString Buffer 34 sec The return from StrFromTimeInterval is 13 The contents of the TimeString Buffer 1 min 14 sec The return from StrFromTimeInterval is 13 The contents of the TimeString Buffer 1 min 10 sec The return from StrFromTimeInterval is 6 The contents of the TimeString Buffer 1 min
Top of Page
© 1997 Microsoft Corporation. All rights reserved. Terms of Use.