PostVirtualMouseEvent

  1. 0 2.0

Posts a virtual mouse code to Windows.

  • oid PostVirtualMouseEvent( UINT wMouseFlags, int xPos, int yPos )

Parameters

wMouseFlags

Flags indicating the type of mouse event. This can be one or more of the following values, combined by a bitwise-OR operator.

Constant
Description
VWM_MOUSEMOVE
Simulates a change in the mouse cursor position. This flag can be combined with any of the other flags in this table.
VWM_MOUSELEFTDOWN
Simulates pushing the left mouse button.
VWM_MOUSELEFTUP
Simulates releasing the left mouse button.
VWM_MOUSERIGHTDOWN
Simulates pushing the right mouse button.
VWM_MOUSERIGHTUP
Simulates releasing the right mouse button.

xPos

The x-axis position in screen coordinates.

yPos

The y-axis position in screen coordinates.

Return Value

This function does not return a value.

Comments

The x- and y-axis positions are absolute positions in screen coordinates. Note that the x and y values should not exceed the screen-resolution limits. Values greater than the maximum resolution in the x-direction (640 for standard VGA) or the y-direction (480 for standard VGA) cause an overflow.

The events are posted to the system message queue. The application with the input focus can receive the messages by calling the Windows GetMessage or PeekMessage message.

Because of the way Windows interprets mouse messages, the calling application must be careful about the order in which events are sent to the system. A message that represents both a button-state transition and a move generates first a Windows event for the button transition at the current pointer location and then a move to the new location. To simulate a move to a new location followed by a button transition, the application must make separate calls to PostVirtualMouseEvent for each simulated event.

Example

When posting events, the caller should bracket the calls by calls to AtomicVirtualEvent, which locks out pen packets while the application is posting simulated mouse events. For example, the following code fragment posts a mouse event:

AtomicVirtualEvent(TRUE);

//

// ... PostVirtualMouseEvent calls go here

//

AtomicVirtualEvent(FALSE);

The Windows GetMessageExtraInfo function returns 0 for any messages generated by PostVirtualMouseEvent.

See Also

AtomicVirtualEvent
, PostVirtualKeyEvent

Software for developers
Delphi Components
.Net Components
Software for Android Developers
More information resources
MegaDetailed.Net
Unix Manual Pages
Delphi Examples
Databases for Amazon shops developers
Amazon Categories Database
Browse Nodes Database