I'm trying to accurately type a hash sign (number sign, pound sign, octothorpe, whatever you call it) using SendInput
in user32.dll.
These are the possible options I see:
Type the number-sign by simulating SHIFT+3 (SHFT_DN, 3_DN, 3_UP, SHFT_UP). My only concern would be US-layout keyboards. Is there a possibility of a system that is configured with non-US layouts to output an incorrect key?
My other option would be to insert the character by the ascii code by simulating key press: ALT+035 (ALT_DN, NUMPAD0_DN, NUMPAD0_UP, NUMPAD3_DN, NUMPAD3_UP, NUMPAD5_DN, NUMPAD5_UP, ALT_UP). Are there any major downfalls to this method? Do all regions share the same ASCII codes and does Windows provide this ALT+### functionality in all regions? This is also going to generate a lot of keystrokes for a single simple character. I don't know if that's a potential problem.
Ideally there would be a Virtual Key Code that was a hash symbol, but I don't see one. Am I missing it?
Any other possibilities that I'm not thinking of? I really need to continue using SendInput
for a few reasons.
So my question is, how do I use SendInput
to simulate a number/hash sign being typed, and make that be global and not-dependent on non-US keyboards with the least number of keystrokes possible?
Thank you