Example: Get the Color under the Mouse Pointer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts
  • Worm
    Indigo Rose Customer
    • Jul 2002
    • 3971

    Example: Get the Color under the Mouse Pointer

    This sample project shows how to get the color underneath the mouse pointer. The values are returned in either Long or Hex.
    Attached Files
  • mke0075
    Forum Member
    • Aug 2004
    • 1

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

    Comment

    • Worm
      Indigo Rose Customer
      • Jul 2002
      • 3971

      #3
      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 I posted to detect when the user clicks the left mouse button so you know what color is actually being picked.



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

      Comment

      • Georges
        Indigo Rose Customer
        • Aug 2004
        • 74

        #4
        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

        Comment

        • JimS
          Indigo Rose Customer
          • May 2003
          • 1057

          #5
          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.

          Comment

          • Georges
            Indigo Rose Customer
            • Aug 2004
            • 74

            #6
            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

            Comment

            • JimS
              Indigo Rose Customer
              • May 2003
              • 1057

              #7
              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.

              Comment

              • Georges
                Indigo Rose Customer
                • Aug 2004
                • 74

                #8
                Hi Jim,

                I like bohemians especially in rhapsodisiatic tunes...

                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

                Comment

                • Georges
                  Indigo Rose Customer
                  • Aug 2004
                  • 74

                  #9
                  How fast are You ??, :lol



                  Enjoy

                  Georges

                  Comment

                  • JimS
                    Indigo Rose Customer
                    • May 2003
                    • 1057

                    #10
                    My reaction time is 375 milli-seconds

                    Comment

                    • Georges
                      Indigo Rose Customer
                      • Aug 2004
                      • 74

                      #11
                      That's because You are a real road runner !

                      Georges

                      Comment

                      • JimS
                        Indigo Rose Customer
                        • May 2003
                        • 1057

                        #12
                        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.

                        Comment

                        • Intrigued
                          Indigo Rose Customer
                          • Dec 2003
                          • 6138

                          #13
                          My score = 225ms

                          See: Attachment

                          Sincerely,
                          Attached Files
                          Intrigued

                          Comment

                          • Georges
                            Indigo Rose Customer
                            • Aug 2004
                            • 74

                            #14
                            225 !!! Whaw This is really FAST...

                            Georges (only 375 msec with practise)

                            Comment

                            • Intrigued
                              Indigo Rose Customer
                              • Dec 2003
                              • 6138

                              #15
                              Originally posted by Georges
                              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)
                              Intrigued

                              Comment

                              Working...
                              X