Why the application receives 2 mouse clicks when I send out 1 mouse_event?

This is a discussion on Why the application receives 2 mouse clicks when I send out 1 mouse_event? within the Windows Programming forums, part of the Platform Specific Boards category; Sometimes it seems multiple mouse clicks are received by the application who owns (dx, dy) location while the following code ...

  1. #1
    Registered User
    Join Date
    Mar 2006
    Posts
    16

    Why the application receives 2 mouse clicks when I send out 1 mouse_event?

    Sometimes it seems multiple mouse clicks are received by the application who owns (dx, dy) location while the following code section only executes once:

    mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE, (DWORD)dx, (DWORD)dy, 0, 0);
    mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN, (DWORD)dx, (DWORD)dy, 0, 0);
    mouse_event(MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTUP, (DWORD)dx, (DWORD)dy, 0, 0);

    Can someone explain this? Should I use some other function to avoid it? BTW I can only control the application which sends out the mouse click.

    Thank you in advance!

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    First, what does mouse_event do ? I don't recall anything like it in the API, is it an extension, if so, which ?

    Have you tried to only send an up or down message ? Is there maybe a CLICK constant instead of UP or DOWN ?
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Registered User
    Join Date
    Mar 2006
    Posts
    16

    sorry for the confusion!

    Did more test and found that the section of code doesn't only execute once when multiple mouse clicks were simulated.

    Here is what happened: I use a program to enumerate the windows on the desktop, and when I see some specific window, I will simulate a mouse click to that window. However, sometimes the window can be found during enumeration but it doesn't really "exist" --- means it is not visible and you can't click it. The mouse click will go to the window "behind" the invisible one. That's why I felt like there are more mouse clicks than it should.

    This is just a clarification and sorry for the confusion!

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. C Programming 2d Array Question
    By jeev2005 in forum C Programming
    Replies: 3
    Last Post: 04-26-2006, 03:18 PM
  2. pointers
    By InvariantLoop in forum C Programming
    Replies: 13
    Last Post: 02-04-2005, 08:32 AM
  3. LISP (DrScheme) any one?
    By Jeremy G in forum A Brief History of Cprogramming.com
    Replies: 5
    Last Post: 03-31-2004, 11:52 AM
  4. Sending a mouse message to the desktop?
    By jakar in forum Windows Programming
    Replies: 6
    Last Post: 01-24-2002, 05:08 PM
  5. A send mail application with source code
    By Rizwan Rafique in forum Windows Programming
    Replies: 8
    Last Post: 01-11-2002, 09:22 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21