Reading the Windows double click threshold

Discussion in 'Game Development (Technical)' started by ggambett, Jul 4, 2007.

  1. ggambett

    Moderator Original Member Indie Author

    Joined:
    Jul 26, 2004
    Messages:
    1,982
    Likes Received:
    5
    I'm trying to figure out how to get the value of the double click threshold in Windows (that is, the max delay between clicks to trigger a double click event - what you configure in the Control Panel). My Google-fu failed miserably this time (in part because half the articles in Google have the term "double click", apparently).

    Anyone knows where in the registry is this stored? Or alternatively, what threshold value do you use?
     
  2. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,212
    Likes Received:
    0
    Win2k:
    HKEY_CURRENT_USER\Control Panel\Mouse\DoubleClickSpeed

    Thats the speed in msec. Defaults to 500.

    edit: Same key for win98se. Note the key doesn't exist if the user has never changed that setting. So, use 500 if the key doesn't exist.
     
    #2 oNyx, Jul 4, 2007
    Last edited: Jul 4, 2007
  3. princec

    Indie Author

    Joined:
    Jul 27, 2004
    Messages:
    4,873
    Likes Received:
    0
    Aside - does anyone know anyone who has ever altered this value in the control panel? I mean, being the sort of user that can't cope with the standard doubleclick speed, you're also probably the sort that more or less can't cope with anything computer related...

    Cas :)
     
  4. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,212
    Likes Received:
    0
    I altered it just now... only to see if its really the right key. Changed it back to 500 right after the test. :)
     
  5. Spaceman Spiff

    Original Member

    Joined:
    Apr 3, 2005
    Messages:
    137
    Likes Received:
    0

    Guilty as charged.. of changing the double click threshold (410). Also of keeping the keyboard repeat rate and threshold as fast as possible.

    As for not coping with anything computer related... You may want to retract that. ;)
     
  6. Donavon Keithley

    Original Member

    Joined:
    Aug 5, 2004
    Messages:
    110
    Likes Received:
    0
    The official API is GetDoubleClickTime(). :)
     
  7. ggambett

    Moderator Original Member Indie Author

    Joined:
    Jul 26, 2004
    Messages:
    1,982
    Likes Received:
    5
    Excellent, thanks a lot!

    BTW, 500 seems ridiculously high. I had hardcoded 250 and I was comfortable with it. Regular people did complain though.
     
  8. jeb_

    Indie Author

    Joined:
    Sep 15, 2005
    Messages:
    194
    Likes Received:
    0
    Heh, our hard-coded value is also 250 ms. That just felt right... guess we need to re-evaluate that :)
     
  9. Matthew

    Indie Author

    Joined:
    Jul 29, 2004
    Messages:
    493
    Likes Received:
    0
    Normal people who rarely use the computer are slow when it comes to double-clicking. You should see my girlfriend's dad:

    "No, you need to double click on it"

    "Click..."

    "..."

    "..."

    "...click."
     
  10. ChrisP

    Indie Author

    Joined:
    Feb 5, 2007
    Messages:
    971
    Likes Received:
    0
    Which is why you should consider carefully before requiring double-clicks as part of your interface - I know some people who have serious trouble pulling one off. You can tell these people because the icons on their desktop are all slightly-misaligned from their failed attempts to double-click on them (they can't keep the mouse still!).
     
  11. Sol_HSA

    Indie Author

    Joined:
    Feb 27, 2005
    Messages:
    470
    Likes Received:
    1
    About a decade ago I was working in the summer at a large company, and noticed when visiting some older person's office that he had trouble doubleclicking stuff, so I tuned his doubleclick value to be even slower. Thanked me for it.

    Personally, I haven't played with it..
     
  12. Desktop Gaming

    Moderator Original Member Indie Author

    Joined:
    Feb 24, 2005
    Messages:
    2,297
    Likes Received:
    12
    lol @ "regular people"! You Batman or something? ;)

    500 is quite high though. You don't notice so much if you're only double clicking on stuff, but when you want to click something twice WITHOUT it being registered as a double-click (when clicking on a file in windows, then again to rename it, for example), waiting half a second before the second click seems like an age.
     
  13. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,212
    Likes Received:
    0
    >Also of keeping the keyboard repeat rate and threshold as fast as possible.

    Hmyea, I also changed that. But I don't really care about the double click speed.

    >[...]when clicking on a file in windows, then again to rename it, for example[...]

    RMB->U for "Umbenennen" (German for "rename"). But usually I use the context menu directly.
     
  14. ChrisP

    Indie Author

    Joined:
    Feb 5, 2007
    Messages:
    971
    Likes Received:
    0
    F2. :)

    (This is one of my little gripes with OSX, incidentally - F2 doesn't rename files. Enter renames files, and Apple-Enter launches them. Why make the "launch file" combination harder to press than the "rename file" combination??? Surely the former is more common. :confused: Seems crazy, but I'm a Mac newbie so maybe I just don't understand the logic. I guess they want everyone to use the mouse to launch files.)
     
    #14 ChrisP, Jul 6, 2007
    Last edited: Jul 7, 2007
  15. Talisman

    Original Member

    Joined:
    Jun 21, 2005
    Messages:
    38
    Likes Received:
    0
    Making 'double click' different from 'clicking twice' is one of the worst usability decisions in Windows.

    Split second timing belongs in action games, not on the desktop.
     
  16. James C. Smith

    Moderator Original Member

    Joined:
    Aug 21, 2004
    Messages:
    1,768
    Likes Received:
    0
    You could also just watch for the WM_LBUTTONDBLCLK message. Windows handles the threshold for you. For this to work you must use the style CS_DBLCLKS when registering your window class.
     
    #16 James C. Smith, Jul 6, 2007
    Last edited: Jul 6, 2007
  17. Nikos Beck

    Nikos Beck New Member

    Joined:
    Jun 14, 2007
    Messages:
    321
    Likes Received:
    0
    My upcoming game is geared to middle-aged men so I'm not using double-click nor right-click in the game. Some initial playtesting showed that the players tended to hold the button a long time, even lifting their hand off the mouse and pressing the button with one finger, then returning their hand to the mouse. And yes, sometimes the mouse would slip and the cursor would fly across the screen.

    When they commented on double-clicking in Windows I told them to click once and press enter. That tends to do exactly the same thing.

    I also tried having them hold shift while clicking but that was a disaster as well. They would stop, look at their left hand to press shift, then look at their right hand to click. It was extremely slow and broke the pace of the game. They also spent too much time looking away from the screen.

    I ended up using a panel along the side with buttons that they would always have access to, it also made more clear what things do what because they could see immediately what the functions were. When I absolutely needed more depth I added two clicks as an option. Click once to select, click again to act. That works well. There is a caveat. I still have issues where objects overlap and things can get confused when the player meant to click on the object behind the one they just clicked on but it performs an action on the selected object. This one I'm still trying to work out. A deselect action is needed but I haven't quite found one yet.

    I also added more tips when the mouse stops on an object. There, again, players couldn't keep the mouse still long enough to see a hover tip. I changed it so that the hover time counted how long it was over an object, not how long it was held still. That improved comprehension considerably.

    But, if you're working on an arcade game or an action game then by all means have double- and triple-clicks on the left and right mouse buttons and integrate shift, control and alt as well.
     
  18. oNyx

    Original Member

    Joined:
    Jul 26, 2004
    Messages:
    1,212
    Likes Received:
    0
    Ah... of course! I knew it worked in Filezilla, but I never tried it in Explorer. :)
     

Share This Page

  • About Indie Gamer

    When the original Dexterity Forums closed in 2004, Indie Gamer was born and a diverse community has grown out of a passion for creating great games. Here you will find over 10 years of in-depth discussion on game design, the business of game development, and marketing/sales. Indie Gamer also provides a friendly place to meet up with other Developers, Artists, Composers and Writers.
  • Buy us a beer!

    Indie Gamer is delicately held together by a single poor bastard who thankfully gets help from various community volunteers. If you frequent this site or have found value in something you've learned here, help keep the site running by donating a few dollars (for beer of course)!

    Sure, I'll Buy You a Beer