none
System.Windows.Forms.Information.DoubleClickTime not changing RRS feed

  • Question

  • Implementing a double click handler for WPF controls that dont have it

    The property System.Windows.Forms.Information.DoubleClickTime is supposed to be that double click interval. its 300 ms when I look at it in code

    Changing the double click speed on the control panel mouse tab is not altering this property

    OS is Windows 8 64, if that matters

    is there another place Im supposed to be reading this from?


    Scott Berger McCormick Systems

    Friday, May 17, 2013 3:18 PM

Answers

All replies

  • You could see if this returns the new value:

    http://msdn.microsoft.com/en-us/library/windows/desktop/ms646258(v=vs.85).aspx

     


    Phil Wilson

    Friday, May 17, 2013 4:38 PM
  • Hi Scott,

    I referenced System.Windows.Forms in a WPF application and let a MessageBox display the value of DoubleClickTime on a machine running Windows 8 (32bit, x64 processor). With default settings I got 500 ms, after adjusting the double click interval in the control panel to the right, the interval decreased to 300 ms.

    The .NET DoubleClickTime-method simply calls over P/Invoke into:

    [DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
    public static extern int GetDoubleClickTime();
    so you have exactly the same OS function referenced by Phil in his posting.

    Marcel

    Friday, May 17, 2013 5:23 PM
  • Phils suggestion to call the function in user32.dll worked

    Yours does not.

    I don't know what the difference is between your system and mine

    My apps are all being coded as 4.5 apps, maybe thats the issue

    or the fact that Im running 64 bit and you are running 32

    Dunno - just know that it didnt work

    It always returned 300ms, even after a program stop, change the mouse click settings, and restarted. 


    Scott Berger McCormick Systems

    Friday, May 17, 2013 5:57 PM
  • Scott,

    this is weird. It's the same function after all. I'll test it on a pure x64 too, but I'm pretty sure you can't make apples out of oranges.

    Marcel

    Friday, May 17, 2013 6:29 PM
  • Hence why I posted the question in the first place

    System.Windows.Forms.Information.DoubleClickTime must be doing something different than GetSystemDoubleClickTime in User32

    Since I dont have the source to .NET, I dont know what its doing :-)

    Its a bug, but I have discovered more than a few things in the .NET libraries that dont behave the way they are documented. I just code around them when I hit them!



    Scott Berger McCormick Systems

    Friday, May 17, 2013 6:33 PM
  • Scott,

    System.Windows.Forms.Information.DoubleClickTime must be doing something different than GetSystemDoubleClickTime in User32

    There is no System.Windows.Forms.Information namespace. You surely meant System.Windows.Forms.SystemInformation. And no, DoubleClickTime is just calling the windows API function GetSystemDoubleClickTime, that's what I was telling you in my post from above. The .NET property is simply a wrapper around the User32.GetSystemDoubleClickTime function and nothing more! It doesn't cache the data in any way.

    Since I dont have the source to .NET, I dont know what its doing.

    I already posted the code that the .NET property calls. It's the code starting with the DllImport attribute. But you can check it on your own, if you want: The code of the .NET framework libraries is freely available here.

    You also can look into the libraries by using tools like .NET Reflector. But I'm afraid that you will not find anything else there, than a very thing wrapper around User32.GetSystemDoubleClick(). Here's the complete property's code:

    // in: System.Windows.Forms.SystemInformation
    public static int DoubleClickTime {
        get { return SafeNativeMethods.GetDoubleClickTime(); }
    }
    
    // in: System.Windows.Forms.SafeNativeMethods
    [DllImport("user32.dll", CharSet=CharSet.Auto, ExactSpelling=true)]
    public static extern int GetDoubleClickTime();
     
    
     
    

    It's a bug ...
    The bug must be hiding somewhere in your code. Maybe you are caching the returned value? - There is not the slightest hint of a bug from what you described so far, no proof whatsoever. Sorry.

    Marcel

    Friday, May 17, 2013 10:54 PM