winforms - VB.NET: In ProcessCmdKey simplest way to determine if a key prints or not? -


what's simplest way identify whether keystroke printable character (one should appear in textbox) or not? want separate keys f1, home, etc. appear in textbox. trying avoid massive if statement identifying non-printable characters myself.

using event keyup, keypress etc. not option due design of control.

there no simple way. , should never put in spot. translation of virtual keys, observed in processcmdkey or keydown, typing keys, observed keypress event, highly convoluted. depends on keyboard layout user has selected. keyboard layouts vary great deal machine machine across world. chinese keyboard doesn't english keyboard, surely can imagine this. furthermore, languages lot of characters, chinese , japanese, use dedicated program allow user select 1 of tens of thousands of glyphs. ime (input method editor).

notably problematic "dead keys", special keys on keyboards used enter letters diacritics. not common in english, common in other parts of world. altgr key on german keyboard. such layouts stateful, key produces different typing character depending on state. in other words, dead keys pressed before. state process specific , cannot retrieved process.

i didn't scare enough, hard english speaking programmer. caution wind, , sounds want own process, can pinvoke tounicodeex() winapi function. needs keyboard state, pinvoking getkeyboardstate(). needs active keyboard layout, getkeyboardlayout(). needs thread id, getcurrentthreadid(). return value of 1 or more indicates keypress event fire. visit pinvoke.net have shot @ getting pinvoke declarations correct.


Popular posts from this blog

How to calculate SNR of signals in MATLAB? -

c# - Attempting to upload to FTP: System.Net.WebException: System error -

ios - UISlider customization: how to properly add shadow to custom knob image -