• Hey! Guest! The 40th (!!!) GMC Jam will take place between February 25th, 12:00 UTC to March 1st 12:00 UTC. Why not join in this very special anniversary jam! Click here to find out more!

Windows double click duration system value ?


I understood that there is no builtin double_click detection in GSM2 (despite the weird "device_mouse_dbclick_enable" function).
So I can program one, it's not a problem.
But to be consistent with user's environment, I'd like to read the OS (Windows) default double click duration.
Do you have an idea how to do that ?


For windows, you can use the Windows API to get the double click time. winuser.h defines the method UINT GetDoubleClickTime(), which returns the double click duration in milliseconds. If you create a C file that imports winuser.h and exposes GetDoubleClickTime, you can compile a DLL and use it as an extension. Using that extension, you should be able to query the OS for double click duration.

Here's a quick mockup of the code:

// DoubleClickInterface.c
#include <winuser.h>
#define gmexport __declspec(dllexport)

gmexport double gm_DoubleClickTime() {
  return (double) GetDoubleClickTime();
Then you can compile with the requisite flags (google them), import the resulting DLL into your project, and create the links for the function.


Thanks. I'm not used to making extensions yet, nor DLL, but I'll try it. Do you know a good tuto that treats the subject of writing a DLL extension for GMS2 ?