7

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#.

enter image description here

Phoenix Logan
  • 1,238
  • 3
  • 19
  • 31
  • would @M. Nasser Javaid answer to a related topic help? http://stackoverflow.com/questions/1092808/warn-about-capslock – luchosrock Jan 09 '13 at 17:11

2 Answers2

5

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);
}
jlew
  • 10,491
  • 1
  • 35
  • 58
1

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;
        }
    }
hunch_hunch
  • 2,283
  • 1
  • 21
  • 26
Alexander
  • 21
  • 1