Simulate Mouse Click

A

Abhishek

Hi,

I have a activex web browser embedded in a windows form and on a click of a
form button i need the mouse to go the position for example 100, 100 and
click the link that will be there on that position.
i am usind the win api setcursonpos to set the mouse position

assume that the link will always be there at 100, 100. how do i get Windows
to create the click event.

i tried using
SendMessage(axWebBrowser1.Handle,WM_LBUTTONDOWN,0,0);
SendMessage(axWebBrowser1.Handle,WM_LBUTTONUP,0,0);

but this is not happening.

any ideas pls.

regards
Abhishek
 
G

Guest

If the link you mentioned is for example a linklabel(or any component) and
you've handled it's OnClick event, it's easy. I assume this, and name the
component as link1, you can simply call link1_OnClick(null, null);

hope this helps
 
A

Abhishek

Hi,

well the browser can go to any webpage to i cant use this. Need to
simulate a proper click on a location.

Regards
Abhishek
 
M

mehdi_mousavi

Well, you've to get the DOM Document of the the HTML page from the
embedded ActiveX control, and simulate the mouse click using the
javascript. This has also to be done by implementing those interfaces
that IE provides. (I cannot remember their names at the moment).

HTH,
Mehdi
 
A

Abhishek

I got the mouse_event function working. my only problem is that i cant pass
the handle of the application with this.
is there any way to pass the handle of the browser with mouse_event to that
the click happens in that application.
 

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