On Sat, 27 Sep 2008 11:00:54 -0700, Blip <bl**@krumpli.comwrote:
Hello -
I'm trying to wite these control characters to the serial port w/o
success.
I've tried sp.Write((Keys.ControlKey & Keys.X).ToString());
sp.Write((Keys.Control & Keys.X).ToString());
What's "sp"? Is that an instance of the SerialPort class?
The bottom line here is that you are trying to mix the user-input data
structures associated with keyboard input with the ASCII used to represent
that input.
The first non-zero byte values for ASCII are reserved for control input.
By convention, the letters are assigned in sequence, with Control-A being
1, Control-B being 2, etc. Control-S would be 19. You can probably
figure out Control-X on your own. :)
Just send the correct byte value. You aren't going to get anywhere trying
to use values from the Keys enumeration, as that's tied to the keyboard,
not ASCII.
Pete