๐Ÿš€ go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.cppbuilder.nativeapi
Article #4281

Re: Timer

#4281
From: Remy Lebeau (TeamB)
Date: Tue, 28 Feb 2006 18:54
30 lines
2274 bytes
"Hans J๏ฟฝnsson" <042140773@telia.com> wrote in message
news:44047cc2@newsgroups.borland.com...

> Start a timer when the word is presented, read the time
> when the person moves on to next word

You don't need a timer for that.  Simple call GetTickCount() when the word
is shown, and again when the word is finished.  The difference between the
two values will be the elapsed time, in milliseconds.

> by pressing something

Pressing a button (or other control) is an action that relies on messages
being placed in, and retreived from, the message queue.  So no matter how
fast your timer is, the overall calculation for the reading speed will be
slowed down by that.  If your main thread is delayed in processing new
messages, your click actions will be delayed, and your calculation will be
inaccurate.

About the only way I can think of to get real-time results at the resolution
you are asking for is to use a global keyboard and/or mouse hook via the
SetWindowsHookEx() function in a DLL.  When the user wants to move on to the
next word, they simply press the keyboard, or move the mouse, or click the
mouse button (but not on anything specific).  The hook(s) can track the
hardware notifications so it can react faster than waiting for the message
queue.


Gambit
Technical Details
Message-ID: <44049c3f$1@newsgroups.borland.com>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail
References: <44034cb3@newsgroups.borland.com> <44036c80$1@newsgroups.borland.com> <44047cc2@newsgroups.borland.com>

Show Full Headers
Complete Article Headers
X-Google-Thread: 10cc67,da4cdffc4a8e862a
X-Google-Attributes: gid10cc67,public
X-Google-Language: ENGLISH,ASCII
From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com>
Newsgroups: borland.public.cppbuilder.nativeapi
References: <44034cb3@newsgroups.borland.com> <44036c80$1@newsgroups.borland.com> <44047cc2@newsgroups.borland.com>
Subject: Re: Timer
Date: Tue, 28 Feb 2006 10:54:47 -0800
Lines: 32
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
NNTP-Posting-Host: 68.69.17.41
Message-ID: <44049c3f$1@newsgroups.borland.com>
X-Trace: newsgroups.borland.com 1141152831 68.69.17.41 (28 Feb 2006 10:53:51 -0700)
Path: arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news4.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!nx01.iad01.newshosting.com!newshosting.com!203.109.252.33.MISMATCH!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail