+ Reply to Thread
Results 1 to 16 of 16

How to control SendInput mouse events?

  1. #1
    Registered User
    Join Date
    11-01-2012
    Location
    helsinki, finland
    MS-Off Ver
    Excel 2007
    Posts
    81

    How to control SendInput mouse events?

    Hi there!

    As you surely know the SendInput has superseded mouse_ event so you are forced,
    at least according to Microsoft, to use SendInput instead. However, the use of it is
    not as simple as one would expect and besides, there is a lot of false information all
    over the internet and I have not been able to find working examples.

    So the question is. Could somebody please point out a web-page with working code,
    or perhaps provide working code here, and just perhaps to move the cursor to a new
    location, that would be enough to get me on track again.

    Thenk you in advance.

    regards
    keymuu

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to control SendInput mouse events?

    keymuu

    Is this an Excel question?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    11-01-2012
    Location
    helsinki, finland
    MS-Off Ver
    Excel 2007
    Posts
    81

    Re: How to control SendInput mouse events?

    Hi Norie!

    This is an Excel VBA forum, isn't it?
    So, this is a real VBA (Excel) question!

    regards
    keymuu

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to control SendInput mouse events?

    Can you explain what you are trying to do?

    Do you want to move the cursor to another location on a worksheet?

  5. #5
    Registered User
    Join Date
    11-01-2012
    Location
    helsinki, finland
    MS-Off Ver
    Excel 2007
    Posts
    81

    Re: How to control SendInput mouse events?

    Hi Norie!

    I try to explain what I'm trying to do:

    I have now:
    Please Login or Register  to view this content.
    And as I earlier stated, SendInput has (or will) override mouse_event and so...
    I try to replace all those routines with SendInput. so, not at all complicated, or is it?

    regards
    keymuu

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to control SendInput mouse events?

    keymuu

    That code won't compile for me, where's the rest?

    Can you explain in words what you are trying to do?

  7. #7
    Registered User
    Join Date
    11-01-2012
    Location
    helsinki, finland
    MS-Off Ver
    Excel 2007
    Posts
    81

    Re: How to control SendInput mouse events?

    Hi again!

    Doesn't compile in your PC?
    Maybe you miss:
    Please Login or Register  to view this content.
    If not that then I don't know why it doesn't compile.
    On the other hand the names of the routines are also quite self describing...
    Here I try to describe
    singleClick - nothing to explain
    doubleClick - "
    rightClick - mouse right button
    getMouse - getCursor would perhaps be a better name
    getMpos - does the same as the previous and writes the coordinates in current cell (x) and in the next right cell (y)
    mouseMove - moves the cursor to the specific x,y position

    regards
    keymuu

  8. #8
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to control SendInput mouse events?

    keymuu

    Yes I did kind of miss that code, wasn't in the post.

    Still one missing though - GetCursorPos.

  9. #9
    Registered User
    Join Date
    11-01-2012
    Location
    helsinki, finland
    MS-Off Ver
    Excel 2007
    Posts
    81

    Re: How to control SendInput mouse events?

    Hello Norie!

    You seem to be very pedantic

    Here is the still missing piece:
    Please Login or Register  to view this content.
    Please be so kind and tell if something is still missing

    regards
    keymuu

  10. #10
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to control SendInput mouse events?

    keymuu

    So, in words, what's the code meant to do?

  11. #11
    Registered User
    Join Date
    11-01-2012
    Location
    helsinki, finland
    MS-Off Ver
    Excel 2007
    Posts
    81

    Re: How to control SendInput mouse events?

    Hi Norie!

    Take a look at post #5 there, as far as I understand, is that explained,
    anyway I believe so....

    regards
    keymuu

  12. #12
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: How to control SendInput mouse events?

    keymuu

    It's not explained in post #5 - all there is in that post is a bunch of uncommented code.

  13. #13
    Registered User
    Join Date
    11-01-2012
    Location
    helsinki, finland
    MS-Off Ver
    Excel 2007
    Posts
    81

    Re: How to control SendInput mouse events?

    Hi Norie!

    Here it is again, with comments...
    Please Login or Register  to view this content.
    Maybe it is clearer now....

    regards
    keymuu

  14. #14
    Registered User
    Join Date
    11-01-2012
    Location
    helsinki, finland
    MS-Off Ver
    Excel 2007
    Posts
    81

    Re: How to control SendInput mouse events?

    Norie,

    now there are comments...
    Why haven't you replied? Too much comments, or what?

    regards
    keymuu

  15. #15
    Registered User
    Join Date
    11-01-2012
    Location
    helsinki, finland
    MS-Off Ver
    Excel 2007
    Posts
    81

    Re: How to control SendInput mouse events?

    Hi there!

    I managed to do a single click with SendInput. Unfortunately I can't remember where I found it,
    but here is the modified, working single click:
    Please Login or Register  to view this content.
    However, this is the only thing I can get to work.
    So, could somebody please share a little bit of light over this matter and help telling how to
    move the cursor/mouse to a specific place on the screen, let's say between 0 and max resolution.
    Maybe also the right click and so on.

    Thank you for your help in advance.


    regards
    keymuu

  16. #16
    Registered User
    Join Date
    11-01-2012
    Location
    helsinki, finland
    MS-Off Ver
    Excel 2007
    Posts
    81

    Re: How to control SendInput mouse events?

    Hi there again

    Of course I lied a little bit when I said the single click is the only thing I got to work,
    a double click is of course just calling the cliciIt twice with a perhaps little delay between
    the clicks...

    Can't anybody or doesn't anybody know how to move the cursor with SendInput?
    Please help if you can!

    regards
    keymuu

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1