I get this when I have Caps Lock on with a password control in focus. I would like to add my own warning instead. How can I disable this one? I don't mind P/Invoke or any native code but it has to be in C#.
In your form, override WndProc like so, which will intercept the EM_SHOWBALOONTIP message and prevent the control from receiving it:
protected override void WndProc(ref Message m)
{
if (m.Msg != 0x1503) //EM_SHOWBALOONTIP
base.WndProc(ref m);
}
The following code works for me, on the KeyDown
event of a TextBox
:
private void txtPassword_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyData == Keys.CapsLock)
{
e.SuppressKeyPress = true;
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With