How to simulate mouse click in vb.net

G

Glenn Palomar

Hi,

Instead of using user32 API for simulating mouse click (left down, left up,
etc.), are there any .net function/class that i can use?
Public Declare Sub mouse_event Lib "user32" (ByVal dwFlags As Int32, ByVal
dx As Int32, ByVal dy As Int32, ByVal cButtons As Int32, ByVal dwExtraInfo
As Int32)

Thanks,

Glenn
 
H

Herfried K. Wagner [MVP]

Glenn Palomar said:
Instead of using user32 API for simulating mouse click (left down, left
up, etc.), are there any .net function/class that i can use?

No.
 
G

Glenn Palomar

Thanks.

How about keboard events? Is there another way of simulating keyboard events
in .net without using keybd_event user32 API.

If none, is this declaration correct?

Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal bScan
As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

Thanks,
Glenn
 
H

Herfried K. Wagner [MVP]

Glenn Palomar said:
How about keboard events? Is there another way of simulating keyboard
events in .net without using keybd_event user32 API.
'SendKeys.Send'.

If none, is this declaration correct?

Public Declare Sub keybd_event Lib "user32" (ByVal bVk As Byte, ByVal
bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)

No, it's incorrect. Change 'As Long' to 'As Int32'.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top