🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
5 messages
5 total messages Started by Hans J�nsson Mon, 27 Feb 2006 19:02
Timer
#4265
Author: Hans J�nsson
Date: Mon, 27 Feb 2006 19:02
3 lines
1038 bytes
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 
Re: Timer
#4271
Author: Remy Lebeau (TeamB)
Date: Mon, 27 Feb 2006 21:18
11 lines
1121 bytes
"Hans J�nsson" <042140773@telia.com> wrote in message
news:44034cb3@newsgroups.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
Re: Timer
#4277
Author: Hans J�nsson
Date: Tue, 28 Feb 2006 16:39
21 lines
1713 bytes
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@no.spam.com> skrev i meddelandet 
news:44036c80$1@newsgroups.borland.com...
>
> "Hans J�nsson" <042140773@telia.com> wrote in message
> news:44034cb3@newsgroups.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
>
> 
Re: Timer
#4281
Author: 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
Re: Timer
#4282
Author: Hans J�nsson
Date: Tue, 28 Feb 2006 19:10
37 lines
2506 bytes
I am really grateful for this solution. hans
"Remy Lebeau (TeamB)" <no.spam@no.spam.com> skrev i meddelandet 
news:44049c3f$1@newsgroups.borland.com...
>
> "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
>
> 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads