# Simulating double-click, how long should I wait between clicks?

I'm simulating a double click programmatically and I want to have a slight pause between both clicks in order to better simulate a real user.

I know the interval should be less than GetDoubleClickTime but am not sure what would be a good time to choose. Does anyone know of any data on how fast a typical person performs a double-click?

I was thinking in the direction GetDoubleClickTime()/3 but of course the magic number seems a bit iffy.

• Why not just say GetDoubleClickTime() - 1? Unless the simulation is specific to the exact double click length a double click is just another input. Nov 9, 2011 at 15:20
• @JoshK sleeping is not always precise, if I oversleep by one millisecond I will get two clicks rather than one double click. Nov 9, 2011 at 15:24
• Doesn't the hardware/operating system determine the difference between a single click and a double click? So as long as you send two clicks within the threshold for what is considered a double click, it doesn't matter. You just need to simulate "a user sent a double click", not all the various timing differences that might be considered a double click. Nov 9, 2011 at 15:44

Does anyone know of any data on how fast a typical person performs a double-click? - doubleclick interval is an adjustable OS user setting.

Our user might not have configured his machine typically.

I don't know what's the issue with GetDoubleClickTime() / 3. Even if there was some research proving that an average person doubleclicks 2.56768 time faster than the required minimum speed - 2.56768 is still a magic number of sorts...

Fire up an audio recording program in a quiet space and double click your mouse a few times. The time distance between the two peaks is how long it takes. If you're feeling really intense, you can calculate the statistical deviation among many clicks.

Me? I'd go with your thought of GetDoubleClickTime()/3. I think you're over-analyzing a double click.

You could do something really fancy, like:

(GetDoubleClickTime() * 2 / 3) + (rand(0, (GetDoubleClickTime() / 2)) - (GetDoubleClickTime() / 4))


But I kinda agree with Jeff. Since catching double clicks is an OS task; and it just comes back to your program as "the user double clicked at (x, y)" I think you might be over-working this a bit.

The simplest way to simulate clicks is to call the handler directly.