Re: How to force a key press/mouse click event? by Barto
Barto
Wed Jun 21 12:04:03 CDT 2006
Not sure if this will help, but this is how I performed the action in VB.NET
Dim'd up the following:
Private Declare Sub mouse_event Lib "coredll.dll" (ByVal dwFlags As Long,
ByVal dx As Long, ByVal dy As Long, ByVal dwData As Long, ByVal dwExtraInfo
As Long)
Private Const MOUSEEVENTF_ABSOLUTE = &H8000& ' absolute move
Private Const MOUSEEVENTF_LEFTDOWN = &H2 ' left button down
Private Const MOUSEEVENTF_LEFTUP = &H4 ' left button up
Private Const MOUSEEVENTF_MIDDLEDOWN = &H20 ' middle button down
Private Const MOUSEEVENTF_MIDDLEUP = &H40 ' middle button up
Private Const MOUSEEVENTF_MOVE = &H1 ' mouse move
Private Const MOUSEEVENTF_RIGHTDOWN = &H8 ' right button down
Private Const MOUSEEVENTF_RIGHTUP = &H10 ' right button up
Private Const MOUSEEVENTF_WHEEL = &H800 ' wheel button rolled
Then called the following function to simulate the mouse event:
mouse_event(MOUSEEVENTF_MOVE, 50, 50, 0, 0)
The above simulated a mouse move event, but I would assume that you can use
the MOUSEEVENTFLEFTDOWN/UP to simulate the proper event.
"krupa.p@gmail.com" wrote:
> I am trying to synthesize a mouse click event. The exact scenario is
> that I need to click on the screen to bring my Flash UI to focus and I
> don't want to do that manually. I want to write code that forces a
> mouse click event.
>
> BTW, this is in a C# application on CF 2.0 for a WinCE 5.0 device.
>
>
> Chris Karcher wrote:
> > Are you trying to click something and simulate a keypress in your own
> > app, or in another one?
> >
>
>