Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Windos
win32.3rdparty
win32.directx.audio
win32.directx.ddk
win32.directx.graphics
win32.directx.input
win32.directx.managed
win32.directx.misc
win32.directx.networking
win32.directx.sdk
win32.directx.video
win32.dirx.grap.shaders
win32.gdi
win32.international
win32.kernel
win32.messaging
win32.mmedia
win32.networks
win32.ole
win32.rtc
win32.tapi
win32.tapi.beta
win32.tools
win32.ui
win32.wince
win32.wmi
windows.mediacenter
winfx.aero
winfx.announcements
winfx.avalon
winfx.collaboration
winfx.fundamentals
winfx.general
winfx.indigo
winfx.sdk
winfx.winfs
  
 
date: 6 Apr 2006 03:10:05 -0700,    group: microsoft.public.win32.programmer.tools        back       


Win32 API Timer   
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
date: 6 Apr 2006 03:10:05 -0700   author:   grubbymaster

Re: Win32 API Timer   
try SetTimer function and handle WM_TIMER message
date: 6 Apr 2006 03:23:56 -0700   author:   WiSO

Re: Win32 API Timer   
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
date: Thu, 06 Apr 2006 11:01:03 GMT   author:   Olof Lagerkvist ess

Re: Win32 API Timer   
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
date: Thu, 06 Apr 2006 15:05:22 +0200   author:   none

Re: Win32 API Timer   
thanks guys fot your help...i've solved the problem. bye
date: 6 Apr 2006 07:14:11 -0700   author:   grubbymaster

Re: Win32 API Timer   
thanks guys for your help...i've solved the problem. bye
date: 6 Apr 2006 07:14:19 -0700   author:   grubbymaster

Re: Win32 API Timer   
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
date: 6 Apr 2006 12:22:05 -0700   author:   Lao K

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us