"P. Meyer" <ph************ *@wanadoo.frwro te in message
news:46******** *************** @news.orange.fr ...
I need to capture a mouse click event when inside a visual third party
ActiveX which unfortunately comes without published events.
In Win32 I used to manage such problems on Application level with WM_
messages, but almost beginner in .NET & C# environment, I don't see the
solution, which is probably trivial for experienced people.
You can also catch the WM_ messages in .Net. During program startup, you
add a message filter:
System.Windows. Forms.Applicati on.AddMessageFi lter(new MyFilterClass() );
You then add a class that implements IMessageFilter to process the
messages. The following example processes a key press, but you can use a
similar technique to process mouse clicks:
class MyFilterClass: IMessageFilter
{
private const int WM_KEYDOWN = 0x100;
public bool PreFilterMessag e(ref Message m)
{
if (m.Msg == WM_KEYDOWN)
{
Keys key= (Keys)(int)m.WP aram & Keys.KeyCode;
if (key==Keys.Deci mal)
{
SendKeys.Send(" ,");
return true;
}
}
return false;
}
}