Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hello,

Is anyone know what other way to send keys. I'm having trouble using SendKeys.Send("{ENTER}{TAB}") on a Citrix (its like a DOS base keying/entry, connecting to a server). Somehow the special keys like enter and tab its not working, but [A-Z][0-9] its fine.

Please Help.

Thanks.

BTW, found this article but reference are missing, hard to find in internet
SendKeys using ScanCodes to Citrix[^]
Posted

1 solution

SendKeys is a pretty bad thing, by a number of reasons. The really universal ways to simulate input events in Windows is SendInput:
https://msdn.microsoft.com/en-us/library/windows/desktop/ms646310%28v=vs.85%29.aspx[^].

You can use it via P/Invoke, which is already done for you: http://www.pinvoke.net/default.aspx/user32.sendinput[^].

And a word of warning for you: try to stay away from technology abuse. The cases when you need to simulate input are quite rare; playing keyboard (keyboard/mouse) macro is one of them; another application could be UI testing tools. Simulation of input should not be used in UI development, for example.

—SA
 
Share this answer
 
Comments
hansoctantan 8-May-15 14:14pm    
Same as sendkeys, it allows [A-Z][0-9] but ENTER and TAB its not.
Sergey Alexandrovich Kryukov 8-May-15 14:16pm    
Nothing here is "same as SendKeys". What's the remaining problem? Will you accept the answer formally?
—SA
hansoctantan 13-May-15 15:00pm    
need to put scancode to make the code works. thanks

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900