?
Solved

System Tray Click and Double click

Posted on 2003-03-01
4
Medium Priority
?
645 Views
Last Modified: 2007-12-19
I would like to use both Click and Double click on my applications system tray icon.  I'm using the common Shell_NotifyIcon API to create the icon and Form_MouseMove to detect any mouse operations that accure.

The problem is that I'm unable to find a way to determan if a mouse event was a single click or a double click since there is no WM_LButtonClick constant.  If I check for LButtonDown or LButtonUp the events both accure with a double click aswell.

Is there anyway to know if the user clicked knowing it was not supposed to be a double click?
0
Comment
Question by:Knarf
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 53

Expert Comment

by:Ryan Chong
ID: 8047173
No, both method are supported, here is the constant values you want:

Private Const WM_LBUTTONDBLCLK = &H203
Private Const WM_LBUTTONUP = &H202
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_RBUTTONUP = &H205

as more if you need help.
0
 
LVL 7

Accepted Solution

by:
webJose earned 600 total points
ID: 8048246
A Click is a concept added in VB.  There is no WM_LBUTTONCLICK message.  Instead, the order of messages and the mouse coordinates are examined to determine if a Click is in order.  For example, a command button will only raise the Click event if the mouse goes down and then up while the mouse cursor is inside the client area of the button.  The window procedure logic for this is something like:

Select case uMsg
    Case WM_LBUTTONDOWN
        m_Pressed = true
        SetCapture hWnd
        Refresh
    CASE WM_MOUSEMOVE
        m_Pressed = MouseCoordsInsideClientArea(hwnd, lParam)
        Refresh
    Case WM_LBUTTONUP:
        if m_Pressed and MouseCoordsInsideClientArea(hwnd, lParam) then
            m_Pressed = false
            ReleaseCapture
            Refresh
            raiseevent Click
            raiseevent MouseUp
        end if
...

As you can see, Click is MouseUp under certain conditions.
0
 

Author Comment

by:Knarf
ID: 8050963
Not a bad approach.  I actually did it a different way. I took the systems double click speed and I waited that long before executing the click command.  

If I double click was producted during the systems double click duration then the click event would not activate.

Its not exactly pretty but it works.
0

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Enums (shorthand for ‘enumerations’) are not often used by programmers but they can be quite valuable when they are.  What are they? An Enum is just a type of variable like a string or an Integer, but in this case one that you create that contains…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month9 days, 23 hours left to enroll

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question