Hey everyone, I have a pretty big problem. I need to develop a program that when opened(CONSOLE), targets a certain process and send the Shift+\ key to it, basically, I need it to type (|) the pipeline character I have tried everything, SendMessage, Postmessage, VM_KEYDOWN, VM_KEYUP and all that stuff. Nothing ever gets it to type that darn character, |. Cab someone please show me how to do that, say in notepad named "Untitled - Notepad". Thank YoU!

Recommended Answers

All 6 Replies

I think you need VK_OEM_5 (or maybe VK_OEM_102).
These are found towards the bottom of this MSDN library page: Keys and Keycodes for Windows Mobile

Or you could try sending the ASCII code for | which is 124(0x7C).

Hey there, I am using the VK_OEM_5 = 0xDC, but it only gets the '\' character. Also the 0x7C did not do anything. It didn't input the character. Thanks for the suggestion anyways though, but I am still at A loss on how to do this:d.

You need to have the Shift key down too (see below). Not sure how you do this though, sorry.

In addition to mapping, the keyboard driver determines which characters the virtual key generates. A single virtual key generates different characters depending on the state of other keys, such as the SHIFT and CAPS LOCK keys. Do not confuse virtual-key codes with characters. Although many of the virtual-key codes have the same numeric value as one of the characters that the key generates, the virtual-key code and the character are two different elements. For example, the same virtual key generates the uppercase "A" character and the lowercase "a" character.

Copied from Receiving Keyboard Input

Have you tried using the System.Windows.Forms.SendKeys class?

Thanks again, but already knew all this, from reading various forums as well as just trial and error. Actually my first endaevor at this was using 0xDC, the OEM_5 virtual key for the |\ key, but it only made the \ character. I tried using keydown and keyup ideas and SOO many other various ideas. I really just cannot get this to work, if anyone has any ideas on how to do Shift+\ which makes |, please tell me. Thank YoU!

Sorry I couldn't help. Good luck.

It is no problem, thanks for the time! Good luck in your endaevors as well :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.