How do I use SendMessage to issue a click??


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 9 of 9

Thread: How do I use SendMessage to issue a click??

  1. #1
    Jim Guest

    How do I use SendMessage to issue a click??


    Hi All,

    I need to make an application that would issue a mouse click to the window
    that is beneath the cursor. But it just would not work. Can someone be kind
    enough to help me out? I thank you here in advance.

    What I basically did was:

    1. get cursor location using GetCursorPos()
    2. get windows handle using WindowFromPoint()
    3. send the click using SendMessage(hwnd, WM_LBUTTONDOWN, 0, 0) and
    SendMessage(hwnd, WM_LBUTTONUP, 0, 0)

    But it seems that the SendMessage part did not work at all. Please tell me
    where I did wrong. Thanks.

    Sincerely

    Jim


  2. #2
    Alan Griggs Guest

    Re: How do I use SendMessage to issue a click??


    Jim,

    You can use the mouse_event API function to simulate a click.

    Alan Griggs


    "Jim" <standing_bear@hotmail.com> wrote:
    >
    >Hi All,
    >
    > I need to make an application that would issue a mouse click to the window
    >that is beneath the cursor. But it just would not work. Can someone be kind
    >enough to help me out? I thank you here in advance.
    >
    >What I basically did was:
    >
    > 1. get cursor location using GetCursorPos()
    > 2. get windows handle using WindowFromPoint()
    > 3. send the click using SendMessage(hwnd, WM_LBUTTONDOWN, 0, 0) and
    >SendMessage(hwnd, WM_LBUTTONUP, 0, 0)
    >
    >But it seems that the SendMessage part did not work at all. Please tell

    me
    >where I did wrong. Thanks.
    >
    >Sincerely
    >
    >Jim
    >



  3. #3
    Alan Griggs Guest

    Re: How do I use SendMessage to issue a click??


    Jim,

    You can use the mouse_event API function to simulate a click.

    Alan Griggs


    "Jim" <standing_bear@hotmail.com> wrote:
    >
    >Hi All,
    >
    > I need to make an application that would issue a mouse click to the window
    >that is beneath the cursor. But it just would not work. Can someone be kind
    >enough to help me out? I thank you here in advance.
    >
    >What I basically did was:
    >
    > 1. get cursor location using GetCursorPos()
    > 2. get windows handle using WindowFromPoint()
    > 3. send the click using SendMessage(hwnd, WM_LBUTTONDOWN, 0, 0) and
    >SendMessage(hwnd, WM_LBUTTONUP, 0, 0)
    >
    >But it seems that the SendMessage part did not work at all. Please tell

    me
    >where I did wrong. Thanks.
    >
    >Sincerely
    >
    >Jim
    >



  4. #4
    Klaus H. Probst Guest

    Re: How do I use SendMessage to issue a click??

    Jim,

    Aside from mouse_event, you can also use the BM_CLICK message.


    --
    .. . . . . . . . . . . . . . . . . . . . . .
    Klaus H. Probst, MVP
    http://www.vbbox.com/
    http://www.mvps.org/ccrp/

    Please post/reply to the newsgroup(s)



    "Jim" <standing_bear@hotmail.com> wrote in message
    news:3a2fed88$1@news.devx.com...
    >
    > Hi All,
    >
    > I need to make an application that would issue a mouse click to the

    window
    > that is beneath the cursor. But it just would not work. Can someone be

    kind
    > enough to help me out? I thank you here in advance.
    >
    > What I basically did was:
    >
    > 1. get cursor location using GetCursorPos()
    > 2. get windows handle using WindowFromPoint()
    > 3. send the click using SendMessage(hwnd, WM_LBUTTONDOWN, 0, 0) and
    > SendMessage(hwnd, WM_LBUTTONUP, 0, 0)
    >
    > But it seems that the SendMessage part did not work at all. Please tell me
    > where I did wrong. Thanks.
    >
    > Sincerely
    >
    > Jim
    >




  5. #5
    Klaus H. Probst Guest

    Re: How do I use SendMessage to issue a click??

    Jim,

    Aside from mouse_event, you can also use the BM_CLICK message.


    --
    .. . . . . . . . . . . . . . . . . . . . . .
    Klaus H. Probst, MVP
    http://www.vbbox.com/
    http://www.mvps.org/ccrp/

    Please post/reply to the newsgroup(s)



    "Jim" <standing_bear@hotmail.com> wrote in message
    news:3a2fed88$1@news.devx.com...
    >
    > Hi All,
    >
    > I need to make an application that would issue a mouse click to the

    window
    > that is beneath the cursor. But it just would not work. Can someone be

    kind
    > enough to help me out? I thank you here in advance.
    >
    > What I basically did was:
    >
    > 1. get cursor location using GetCursorPos()
    > 2. get windows handle using WindowFromPoint()
    > 3. send the click using SendMessage(hwnd, WM_LBUTTONDOWN, 0, 0) and
    > SendMessage(hwnd, WM_LBUTTONUP, 0, 0)
    >
    > But it seems that the SendMessage part did not work at all. Please tell me
    > where I did wrong. Thanks.
    >
    > Sincerely
    >
    > Jim
    >




  6. #6
    mrfelis Guest

    Re: How do I use SendMessage to issue a click??

    Have you tried the mouse_event API?

    --
    ~~~
    !ti timda I ,KO
    ..em deppals nocaeB sivaM
    !draH
    ~~
    C'Ya,
    mrfelis@yahoo!com
    Jim <standing_bear@hotmail.com> wrote in message
    news:3a2fed88$1@news.devx.com...
    >
    > Hi All,
    >
    > I need to make an application that would issue a mouse click to the

    window
    > that is beneath the cursor. But it just would not work. Can someone be

    kind
    > enough to help me out? I thank you here in advance.
    >
    > What I basically did was:
    >
    > 1. get cursor location using GetCursorPos()
    > 2. get windows handle using WindowFromPoint()
    > 3. send the click using SendMessage(hwnd, WM_LBUTTONDOWN, 0, 0) and
    > SendMessage(hwnd, WM_LBUTTONUP, 0, 0)
    >
    > But it seems that the SendMessage part did not work at all. Please tell me
    > where I did wrong. Thanks.
    >
    > Sincerely
    >
    > Jim
    >




  7. #7
    mrfelis Guest

    Re: How do I use SendMessage to issue a click??

    Have you tried the mouse_event API?

    --
    ~~~
    !ti timda I ,KO
    ..em deppals nocaeB sivaM
    !draH
    ~~
    C'Ya,
    mrfelis@yahoo!com
    Jim <standing_bear@hotmail.com> wrote in message
    news:3a2fed88$1@news.devx.com...
    >
    > Hi All,
    >
    > I need to make an application that would issue a mouse click to the

    window
    > that is beneath the cursor. But it just would not work. Can someone be

    kind
    > enough to help me out? I thank you here in advance.
    >
    > What I basically did was:
    >
    > 1. get cursor location using GetCursorPos()
    > 2. get windows handle using WindowFromPoint()
    > 3. send the click using SendMessage(hwnd, WM_LBUTTONDOWN, 0, 0) and
    > SendMessage(hwnd, WM_LBUTTONUP, 0, 0)
    >
    > But it seems that the SendMessage part did not work at all. Please tell me
    > where I did wrong. Thanks.
    >
    > Sincerely
    >
    > Jim
    >




  8. #8
    Karl E. Peterson Guest

    Re: How do I use SendMessage to issue a click??

    Everyone's suggesting mouse_event, so I'll recommend the MouseEvent.zip sample on my
    site. <g>
    --
    http://www.mvps.org/vb


    "Jim" <standing_bear@hotmail.com> wrote in message news:3a2fed88$1@news.devx.com...
    >
    > Hi All,
    >
    > I need to make an application that would issue a mouse click to the window
    > that is beneath the cursor. But it just would not work. Can someone be kind
    > enough to help me out? I thank you here in advance.
    >
    > What I basically did was:
    >
    > 1. get cursor location using GetCursorPos()
    > 2. get windows handle using WindowFromPoint()
    > 3. send the click using SendMessage(hwnd, WM_LBUTTONDOWN, 0, 0) and
    > SendMessage(hwnd, WM_LBUTTONUP, 0, 0)
    >
    > But it seems that the SendMessage part did not work at all. Please tell me
    > where I did wrong. Thanks.
    >
    > Sincerely
    >
    > Jim
    >



  9. #9
    Karl E. Peterson Guest

    Re: How do I use SendMessage to issue a click??

    Everyone's suggesting mouse_event, so I'll recommend the MouseEvent.zip sample on my
    site. <g>
    --
    http://www.mvps.org/vb


    "Jim" <standing_bear@hotmail.com> wrote in message news:3a2fed88$1@news.devx.com...
    >
    > Hi All,
    >
    > I need to make an application that would issue a mouse click to the window
    > that is beneath the cursor. But it just would not work. Can someone be kind
    > enough to help me out? I thank you here in advance.
    >
    > What I basically did was:
    >
    > 1. get cursor location using GetCursorPos()
    > 2. get windows handle using WindowFromPoint()
    > 3. send the click using SendMessage(hwnd, WM_LBUTTONDOWN, 0, 0) and
    > SendMessage(hwnd, WM_LBUTTONUP, 0, 0)
    >
    > But it seems that the SendMessage part did not work at all. Please tell me
    > where I did wrong. Thanks.
    >
    > Sincerely
    >
    > Jim
    >



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center