VB and VBA Users Source Code: Re: Sending mouse events to the screen (inc. click events)
[
Home
|
Contents
|
Search
|
Reply
|
Previous
| Next ]
VB/VBA Source Code
Re: Sending mouse events to the screen (inc. click events)
By:
Nick
Email (spam proof):
Email the originator of this post
Date:
Thursday, November 07, 2013
Hits:
134
Category:
Windows API
Article:
Hi Andrew Me Again. Further more from my last posting. I was able to adapt the code to hold down the left mouse button by adding in new events called 'eLeftDown' and 'eLeftUp'. I copied the format of the other mouse events to create the code snippet below: Case eLeftDown 'Move the mouse mouse_event MOUSEEVENTF_MOVE Or lCoordBit, dX, dY, 0&, 0& DoEvents 'Send a left click down mouse_event MOUSEEVENTF_LEFTDOWN Or lCoordBit, 0&, 0&, 0&, 0& Case eLeftUp 'Move the mouse mouse_event MOUSEEVENTF_MOVE Or lCoordBit, dX, dY, 0&, 0& DoEvents 'Send a left click up mouse_event MOUSEEVENTF_LEFTUP Or lCoordBit, 0&, 0&, 0&, 0& Also you have to add the following to the 'Public Enum eButtons' section: eLeftDown = 32 eLeftUp = 64 This will work but if your mouse cursor clicks on a Excel cell the code will pause whilst the left mouse down event is happening until u send a left mouse up event. If you set up the code to click down on another window, for example the recording SW i am using, it will proceed with the code whilst keeping the left down mouse event until a left up mouse event is sent. This means that I was able to click the left mouse button down play a .wav file and then release the left mouse button. Hopefully this may help someone else in the future
Terms and Conditions
Support this site
Download a trial version of the Excel Workbook Rebuilder