views:

31

answers:

1

When sending the WM_MOUSEMOVE message to the client area of an application (in this case Open Office Writer) the image will flicker as if the mouse is over the specified coordinates, but does not stay in that state. The code is:

PostMessage(hWndClient, WM_MOUSEMOVE, 0, MAKEWORD(x, y))

where x and y are relative to the client area.

Sending this in a loop still does not work as the area highlighted by the mouse over event will just flicker.

Any help would be appreciated.

+1  A: 

The app could be triggering on all sorts of other events. Maybe it wants to see WM_MOUSEHOVER etc... It's been long a while, but I remember there being something really klugy about how some of these events were implemented - like there was a separate thread that polled the mouse and generated WM_MOUSELEAVE events when the mouse was no longer over the window. You could be getting bitten by something like that too. It's also possible that the application itself is polling the mouse for its true position when it receives the event.

Depending on what you're trying to do, perhaps you could programmatically move the mouse instead of just trying to fake events. Unfortunately, I don't remember the API for this, but I'm sure it's possible.

xscott
You were right, the application was calling GetWindowPos after the WM_MOUSEMOVE message.