Cancel right-mouse click

  • Thread starter Thread starter Maurice Mertens
  • Start date Start date
M

Maurice Mertens

Hi all,

I want to cancel the right-mouse click on a control in VB.NET. Does anyone
know how to do this?


--
Met vriendelijke groet / With regards / Saludos,
Moviat Automatisering


Maurice Mertens
mauricem@moviat_KillSpamWordForEMail.nl

tel: +31 162 470 534
fax: +31 162 470 502
 
You could override WndProc of your control, look for WM_RBUTTONDOWN and
ignore it by not calling the base class. Call base class for all other
messages. Something like this(c# version):

protected override void WndProc(ref System.Windows.Forms.Message m)
{
if(m.Msg == 0x204) // WM_RBUTTONDOWN
{
return; // Dont call the base class here
}
base.WndProc(ref m); // pass it on to base class
}

_____________
Ajay Kalra (MVP - VC++)
(e-mail address removed)
 
Back
Top