Lars Lars - 3 months ago 33
Vb.net Question

Use SendKeys to send Alt combinations to enter special characters

I want to send an Alt combination to another window within a on-screen keyboard.
With combination I mean when you hold down Alt and enter a number or hexadecimal(registry key has to be set for hex) combination:

ALT down, Add press, 2 press, 5 press, 1 press, ALT up


I tried

SendKeys.SendWait("%{ADD}251")
but it's Alt+Add 2 5 1

SendKeys.SendWait("%{ADD}%2%5%1)"
but it's Alt+Add Alt+2 Alt+5 Alt+1

SendKeys.SendWait("%({ADD}251)")
but it's Alt and then the other keys pressed simultaneously

Ref to MSDN

Any suggestions for a solution with SendKeys or other classes?

[Edit]
Solution:

Example for CharCode (Element of enum Source):
ʊ = &H28A


Dim CharCodeUnicodeStr As String = Hex(CInt([Enum].Parse(GetType(Source), CharStr))).ToString
SendKeys.SendWait("%{ADD}%" & ChrW(Convert.ToInt32(CharCodeUnicodeStr, 16)))

Answer

Have you tried

SendKeys.SendWait("%{ADD}%" & ChrW(&H251))

This will convert your hexa code into a char. Then if you have control over the other application you can revert this char back to a number...