Results 1 to 8 of 8

Thread: [02/03] How do I access mouse double-click speed?

  1. #1

    Thread Starter
    Lively Member bmilano's Avatar
    Join Date
    Jan 2005
    Location
    Broad Run, VA
    Posts
    126

    Question [02/03] How do I access mouse double-click speed?

    Hi,

    Is there are way for me to retreive the current setting of the Windows double-click speed? I need to create my own double-click event on a control and I'd like to use the same speed threshold as all of the other controls.

    Thanks,
    Bill
    If you like my posts, please rate them so I can be somebody!

  2. #2
    Arabic Poster ComputerJy's Avatar
    Join Date
    Nov 2005
    Location
    Happily misplaced
    Posts
    2,513

    Re: [02/03] How do I access mouse double-click speed?

    Check in the windows "API forum"
    "I'm not normally a praying man, but if you're up there, save me... Superman!" - Homer Simpson
    My Blog

  3. #3
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [02/03] How do I access mouse double-click speed?

    Quote Originally Posted by bmilano
    Hi,

    Is there are way for me to retreive the current setting of the Windows double-click speed? I need to create my own double-click event on a control and I'd like to use the same speed threshold as all of the other controls.

    Thanks,
    Bill
    What kind of control are you creating? If you are making a control for a windows form, that inherits from the base control class, it gets a double click event by default through inheritance...

  4. #4

    Thread Starter
    Lively Member bmilano's Avatar
    Join Date
    Jan 2005
    Location
    Broad Run, VA
    Posts
    126

    Re: [02/03] How do I access mouse double-click speed?

    Hi Kleinma,

    The reason is pretty weird, and kind of a long story...basically, it's a picture box which, of course, already has a Double-Click event. However, I'm doing something with a third-party COM object on the Click event that sometimes clobbers the Double-Click event, and I instead get two single clicks. The producer of the COM object doesn't know why this is happening.

    Whether or not it does clobber the Double-Click event is dependent on the type of data involved. So, I can do some logic to decide whether I need to manually do the Double-Click or not. That (really lame) workaround works, but I want my double-click speed to be the same one Windows uses in case the user has changed the Windows setting.

    Such is my life.

    Bill
    If you like my posts, please rate them so I can be somebody!

  5. #5
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [02/03] How do I access mouse double-click speed?

    so this 3rd party control has to sit in a picturebox?

    sorry if I am not anwering your question directly, I just figured there may be some other, cleaner way to go about it.

    Also make sure you test this in a compiled environment, I have seen controls act weird while under debugging (attached to the IDE) but act normal when compiled in release mode and run independant of the IDE. It may have the same behavior.. but it also may not.

    Anyways, if all else fails, here is the answer to your original question

    VB Code:
    1. Private Declare Function GetDoubleClickTime Lib "user32" Alias "GetDoubleClickTime" () As Integer
    2.  
    3. 'usage
    4. MessageBox.Show(GetDoubleClickTime.ToString)

  6. #6

    Thread Starter
    Lively Member bmilano's Avatar
    Join Date
    Jan 2005
    Location
    Broad Run, VA
    Posts
    126

    Re: [02/03] How do I access mouse double-click speed?

    Matt,

    Thanks for your help. I will give your code a try when I get back from vacation. I will also give my existing code a try in a released version.

    As for the control, the picture box just has a picture in it that represents some file. A single-click selects it and loads the file into a third-party control (a video player in my app, to be precise) and a double-click opens the file in Windows Media Player (just like Windows Explorer).

    When the file in question is an MPG, all is good. However, when it is an ASF, the loading it into the third-party control in the picture box's Click event prevents the Double-Click from occurring. I know it sounds odd, but it's true.

    Bill
    If you like my posts, please rate them so I can be somebody!

  7. #7
    I'm about to be a PowerPoster! kleinma's Avatar
    Join Date
    Nov 2001
    Location
    NJ - USA (Near NYC)
    Posts
    23,373

    Re: [02/03] How do I access mouse double-click speed?

    what 3rd party control is it you use?

  8. #8

    Thread Starter
    Lively Member bmilano's Avatar
    Join Date
    Jan 2005
    Location
    Broad Run, VA
    Posts
    126

    Unhappy Re: [02/03] How do I access mouse double-click speed?

    It's a custom control and our relationship with the vendor is proprietary.

    Long story short, it is a COM object that acts as a video player for MPEG-2 and MPEG-4 and a video format translator (MPEG-4 to MPEG-2 and MPEG-2 to Real Media and MPEG-4 to Real Media).

    Not exactly sure how it works behind the scenes, but I associate a panel control with that COM object, I load the name of the file to play (or translate), and I send a "PLAY" command and it plays. If I load an MPEG-2 into the player on my Click event, everything is fine. However, if I load an MPEG-4 into the player on my Click event, it prevents the Double-Click from firing. By process of elimination, I have concluded that it is, in fact, the statement when I load the file into the player that does this.

    As a side note, my Double-Clicks getting clobbered seems to be an ongoing theme with me. I had a posting about a year ago with a similar problem. In that case, it turned out to be that I was changing the BorderStyle of the picture box on the Click, and that was causing the Double-Click not to happen.
    If you like my posts, please rate them so I can be somebody!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width