 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Hans Jönsson Guest
|
Posted: Mon Feb 27, 2006 8:03 pm Post subject: Timer |
|
|
Is there in bcb a good way of timing input to 1/10 of a second in a reliable
way. I remember from Petzold that Windows' doesn't offer a good way to do
it. greetins hans |
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Mon Feb 27, 2006 10:03 pm Post subject: Re: Timer |
|
|
"Hans Jönsson" <042140773 (AT) telia (DOT) com> wrote in message
news:44034cb3 (AT) newsgroups (DOT) borland.com...
| Quote: | Is there in bcb a good way of timing input to 1/10 of
a second in a reliable way.
|
What exactly are you trying to accomplish?
Gambit |
|
| Back to top |
|
 |
Hans Jönsson Guest
|
Posted: Tue Feb 28, 2006 5:03 pm Post subject: Re: Timer |
|
|
I want to present a word on the screen and measure the time it takes for
somebody to read the word. Start a timer when the word is presented, read
the time when the person moves on to next word (by pressing something, never
mind unreliability in this device - I know how to handle that ). Accuracy of
1/10 of a second is enough. If it were 1/100 or even higher I wouldn't
complain but it isn't necessary.
"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> skrev i meddelandet
news:44036c80$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
"Hans Jönsson" <042140773 (AT) telia (DOT) com> wrote in message
news:44034cb3 (AT) newsgroups (DOT) borland.com...
Is there in bcb a good way of timing input to 1/10 of
a second in a reliable way.
What exactly are you trying to accomplish?
Gambit
|
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Feb 28, 2006 8:03 pm Post subject: Re: Timer |
|
|
"Hans Jönsson" <042140773 (AT) telia (DOT) com> wrote in message
news:44047cc2 (AT) newsgroups (DOT) borland.com...
| Quote: | 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.
| Quote: | 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 |
|
| Back to top |
|
 |
Hans Jönsson Guest
|
Posted: Tue Feb 28, 2006 8:03 pm Post subject: Re: Timer |
|
|
I am really grateful for this solution. hans
"Remy Lebeau (TeamB)" <no.spam (AT) no (DOT) spam.com> skrev i meddelandet
news:44049c3f$1 (AT) newsgroups (DOT) borland.com...
| Quote: |
"Hans Jönsson" <042140773 (AT) telia (DOT) com> wrote in message
news:44047cc2 (AT) newsgroups (DOT) 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
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|