# Simulate mouse click at a webbrower control in Visual C++



## paul388 (Jun 25, 2005)

Hi Support,

I want to simulate a mouse click at a webbrower control in Visual C++ 6 with no response. Operating system window/xp.

SendDlgItemMessage(IDC_EXPLORER1, WM_LBUTTONDOWN , (WPARAM)MK_LBUTTON, (LPARAM)0);
SendDlgItemMessage(IDC_EXPLORER1, WM_LBUTTONUP , (WPARAM)MK_LBUTTON, (LPARAM)0);
-----------------------------------------------------------------------
But if I send the similiar message to a push button then it works. Why?

SendDlgItemMessage(IDC_BUTTON1, WM_LBUTTONDOWN , (WPARAM)MK_LBUTTON, (LPARAM)0);
SendDlgItemMessage(IDC_BUTTON1, WM_LBUTTONUP , (WPARAM)MK_LBUTTON, (LPARAM)0);


----------



## del_ross (Oct 24, 2002)

could u tell us a little more about 

1. what exactly u are trying to do with the mouseclick
2. is it a click on a particular link inside?

code snippet would be helpful also.


----------



## paul388 (Jun 25, 2005)

del_ross said:


> could u tell us a little more about
> 
> 1. what exactly u are trying to do with the mouseclick
> 2. is it a click on a particular link inside?
> ...


 Yes, I try to simulate a click on a link inside a web browser control. What I do is to create a simple dailog application with a web browser control inside. The application will send a click message to a link within the web page but it doesn't work.

The message I send to the web browser control is

SendDlgItemMessage(IDC_EXPLORER1, WM_LBUTTONDOWN , (WPARAM)MK_LBUTTON, (LPARAM)0);
SendDlgItemMessage(IDC_EXPLORER1, WM_LBUTTONUP , (WPARAM)MK_LBUTTON, (LPARAM)0);

where IDC_EXPLORER1 is the web browser control.


----------

