PDA

View Full Version : Example: Get the Color under the Mouse Pointer



Worm
08-11-2004, 08:39 PM
This sample project shows how to get the color underneath the mouse pointer. The values are returned in either Long or Hex.

mke0075
08-12-2004, 09:07 AM
thnx please explain that howcan i do that example, and how i can use this example in my applaction

Worm
08-12-2004, 09:14 AM
All the code is in the Page's On Timer Event. It's very straight forward and you should be able to figure it out from there. You'd probably want to use it in conjunction with the mouse.dll (http://www.indigorose.com/forums/showthread.php?t=7659&highlight=mouse.dll) I posted to detect when the user clicks the left mouse button so you know what color is actually being picked.




thnx please explain that howcan i do that example, and how i can use this example in my applaction

Georges
08-26-2004, 03:05 AM
Hi,

I am still a bit thinkering around my reaction time application. The problem is that capturing keybord events adds about 40-50 msec to the registred reaction time wich is not really acceptable. Special purpose keypads use a microcontroller timer and intelligent protocols and bring down the variance to 1 msec precision wich is of course excellent (even slightly overkill) but are very expensive. It seems that mouseclicks or gamepads only add about 4-5 msec. Is anybody aware if this statement is true ? As I would like to use this program for evalution of driving capacity (time to hit the brake on visual and acoustical warning signal) I am wondering if I could use the same game devices I see some guys use in these (fanbtastic :-) games like microsoft wheel and pedals devices. problem : how to call these from ams pro ?,

Sincerely,

Georges

JimS
08-26-2004, 04:35 AM
Georges,
Iím with you in wishing for a way to capture feedback from joysticks, etc.

On a slightly different note, Iím a bit curious about the this keyboard latency issue. I might be wrong here, but I think that the 40-50 msec comes not from the speed of the physical switches on the keyboard, but rather the amount of time it takes to run the code necessary to process the data.

If this is indeed the case, I donít understand how a gamepad would reduce this latency to 4 Ė 5 msec. Wouldnít the amount of latency be more closely tied to the amount of code (logic) needed to process or capture the button click?

If my assumptions are true, I canít see where we can come up with the 4-5 msec numbers. I mean, we donít have the code necessary to capture button clicks on a gamepad. Will the code be three lines long, or thee thousand lines long?

Iím truly not trying to give you a bad time here. Iím not smart enough to provide the code to use gamepads, so Iím trying to think of an alternate method.

You mention that using a keyboard results in 40 Ė 50 msec of latency. I wonder if it would be possible for an end user to calibrate his particular machine.

For instance, before a user takes the test, they must go through calibration. Calibration might consist of a count down timer. The timer (in big bold numbers) starts at 10, then counts down to 0 at even 1 second intervals. The user tries to click the space bar at the exact instant that the clock reaches 0. I wonder if the user was to take this calibration test say three times, and the latency was measured and averaged between the three times, if it might not allow you to figure that particular machinesí latency.

After you calibrate the latency, subtract that number from the test answers.

Sorry I canít give you the answer you are looking for.

Georges
08-26-2004, 05:04 AM
Dear Jim,

Thanks for the good ideas and Your input on discussing this . I am not at all an expert myself on this topic but managed to find some bits and pieces of documentation. The 40-50 msec delay seems to have to do with the fenomenon of "bouncing" key's and this is specific to the way keys on a keyboard are constructed (spring mechanism) and operate. Once captured and stored in a buffer these values have to be stored in registry, catched by layers of windows buffers and functions before they "enter" in the e_keyevent variable where they are then available for our programs and action scripts. This last part of the traject is indeed the same for mouse clicks and gamepad triggers but the previous part seems to be quite diferent ( I do not have details on this but am looking further into it). The procedure that You are proposing is already a (compex) reaction time measurement paradigm in itself as anticipation enters in te setup. Indeed a user will anticipate the time necessary for going fron the last "1" to the "zero" number wich triggers his reaction. But it is indeed generally a good idea that has been incorporated at machine level by the microcontrollers I was mentioning (expensive 1 msec accuracy systems). They have low level calibration routines where they send a byte to the hostPC that has to send it back. That allows to calculate and compensate for any host specific "low level" delay's (nice trick). Following Your suggestion a "higher level" calibration procedure could take advantage of the page.timer and on page.time event automatically trigger the reaction start event and calculate mean and standard deviation of the delay. Thanks for the feed back. Discussing this sparkles idea's.

PS I just subscribed to the developer section of Logitech in order to get their developers kit wich hopefully can make the proces of interfacing their devices a bit more friendly.

Anyhow I will keep the forum posted.

Cheerio,

PS

This link: http://www.cedrus.com/lumina/index.htm

contains input from Cedrus the professionale respons pad controller. On their site You will find explanations on the protocols and C routines to operate on it.


Sincerely,

Georges

JimS
08-26-2004, 05:33 AM
Georges,
Thanks for the explanation. I understand a bit better now. It surprises me that the additional latency is in fact from the keyboards, and the way Windows ô handles them. I learn something new everyday.

Iím most happy if any of my comments spark any additional thoughts for you. Please do keep us posted on what you find out. I think being able to add gamepads and/or joysticks to our projects would be cool. Itís a add-on or plug-in that Iíd pay for. Of course, any use that Iíd have for a joystick, would seem rather bohemian next to what you are building. :)

Georges
08-26-2004, 06:50 AM
Hi Jim,

I like bohemians especially in rhapsodisiatic tunes... :p

Seriously, I really admire and respect the game engines and gaming software. If I see what "anemic GUI" our psychologist offer to patients in contrast to richness and interactivity levels of modern games I feel well... a bit ashamed. Most of the systems we use in our neurocognitive labs are rather "flat" compared to modern distributed gaming. When one observes the interactive action and complexity that kids handle in SOF or other action games in LAN parties one cannot but admire the technology and engineering "tour de forvce" behind all this. Of course there are more customers (and more money involved) in gaming then in health providing services but then again with a bit more fantasy from the part of our governemental organisations (unless government and fanasy are boolean false) we should be able to work up to that level. Unfortunately this is far from being the case today. Of course there are growing initiatives (fi in the field of virtual reality and simulation software) but at the level of the individual phycician or therapist this is still very expensive and really out of reach. Lured by some racing games I have been looking into these gaming engines in order to create a driving simulator not only for evaluation of driving ability but especially to provide older people with meaningfull and risk free training. There was once an ATARI system like that. Now oblivious. Only some compagnies offer script driven engines (as far as I know) There are some commercial initiatives (fi STISIM-- very good BTW) http://www.systemstech.com/stidrsm1.htm
on the market but they are all to expensive for me.

Therefore I will try to use AMS5.0 Pro to construct a "poor mans drive simulator" (positive side effects: it keeps us young and brain-awake!!).

Thanks for the chat.

Georges

Georges
08-26-2004, 08:40 AM
How fast are You ??, :lol

http://www.bmeijer.com/games/reaction_tester/

Enjoy

Georges

JimS
08-26-2004, 12:43 PM
My reaction time is 375 milli-seconds

Georges
08-26-2004, 01:37 PM
That's because You are a real road runner !

Georges :p

JimS
08-26-2004, 02:06 PM
Ack! Me a road runner? Watch the name calling there Beaker.
Har. :)

Actually, I tried it about 5 times and only reported my best score. If I averaged them, it might add 100 - 200 msec to my score.

Intrigued
08-26-2004, 02:24 PM
My score = 225ms

See: Attachment

Sincerely,

Georges
08-26-2004, 02:44 PM
225 !!! Whaw This is really FAST...

Georges (only 375 msec with practise)

Intrigued
08-26-2004, 02:50 PM
225 !!! Whaw This is really FAST...

Georges (only 375 msec with practise)
I probable did the exercise about 10 to 15 times.

I had, I believe it was, three (3) of the 225ms.

Online Medal of Honor - Allied Assault gaming skills coming in handy finally. (grin)

Raj Kulshrestha
11-05-2005, 04:30 AM
Whee! I managed 25ms!!!!! and I only used one finger too... See attachment.

Raj Kulshrestha

Intrigued
11-05-2005, 06:03 PM
I don't see how you can have such a short response time and do such exercise properly, because of several mitigating factors.

But, if you did somehow get such (cough), congrats.

;)

Corey
11-19-2005, 08:34 AM
The key is to look only at the first checkmark and hold the button down so you only have to release it. I think it will be hard to hit the next increment (175 ms) especially with a wireless mouse, which probably adds about 9-12ms or so in latency... :yes

Intrigued
11-19-2005, 11:17 AM
Exactly Corey, that's why his claim of
I managed 25ms!!!!! was making me (cough).

:-D

And the reason you put forth to why one can defeat such... exactly again.

Corey
11-19-2005, 11:34 AM
I think he was joking, or as they say in Sweden, yoking. And a jolly good larf it t'was I dare say, yoho! :D

Intrigued
11-19-2005, 11:40 AM
One never knows.

;)