Hello I want to display the time elapsed since an event ocured (in mins:secs).How can i do this , what functions to call in Win32 (not MFC)?.I'm currently testing GetTickCount().If you have an ideea about this please let me know.Thanks Bye
try SetTimer function and handle WM_TIMER message
grubbymaster wrote: > Hello > > I want to display the time elapsed since an event ocured (in > mins:secs).How can i do this , what functions to call in Win32 (not > MFC)?.I'm currently testing GetTickCount().If you have an ideea about > this please let me know.Thanks GetTickCount() works very well for what you are trying to do. Save the return value when the event occured and subtract that value from the value returned when you want to display the elapsed time. Note that with this method you get milliseconds and you cannot use this method when the time elapsed since the event occured is longer than about 49.7 days. A better method without practical limitations might be to use GetSystemTimeAsFileTime() and save that value when the event occures and subtract that (64-bit) value from the value returned when you want to display the elapsed time. In this case you get the time difference as a 64-bit FILETIME structure which you can convert using FileTimeToSystemTime() to a SYSTEMTIME structure which can be used in a call to GetTimeFormat() to create a string representing the elapsed time if you want to display a string representing the time somewhere. -- Olof Lagerkvist ICQ: 724451 Web: http://here.is/olof
grubbymaster wrote: > Hello > > I want to display the time elapsed since an event ocured (in > mins:secs).How can i do this , what functions to call in Win32 (not > MFC)?.I'm currently testing GetTickCount().If you have an ideea about > this please let me know.Thanks > > Bye > Standard C function time() will do fine here. -- 677265676F727940346E6575726F6E732E636F6D
thanks guys fot your help...i've solved the problem. bye
thanks guys for your help...i've solved the problem. bye
Just a reminder: Pocket PC sleeps, so GetTickCount() might give you a surprise if your program has to run for a relatively long time. Read here: - Pocket PC Power Management Series 7: Trap of GetTickCount, and Sleep() (http://windowsmobilepro.blogspot.com/2006/01/pocket-pc-power-management-series-7.html) Olof points out one practical limit of GetTickCount() that you might shrug off, but what I want to point out is a really serious one. The solution is to use GetLocalTime() and do ULONGLONG arithmetic operation, or use QueryPerformanceCounter(). More generally, read a series of posts on Pocket PC power management: http://search.blogger.com/?ie=UTF-8&ui=blg&bl_url=windowsmobilepro.blogspot.com&x=0&y=0&as_q=%22Power%20Management%22&scoring=d --- Lao K Windows Mobile Pocket PC Smartphone Programming Hints and Tips http://windowsmobilepro.blogspot.com