You should avoid this kind of code. Using Control.IsKeyLocked(Keys.CapsLock) has no problem. But calling a function in a system DLL should be avoided as long as possible. You can make all letters capitel or lower case in a control input.