Reputation: 2773
I'm using SendKeys
to send key strokes to a program.
This is my code:
If whandle <> 0 Then
User32.SetForegroundWindow(whandle)
System.Windows.Forms.SendKeys.Send("+")
End If
(I tried also SendWait()
instead of Send()
)
This is my window hierachy shown by Spy++:
Althoug I can find window handle by title and loop through childs with User32.FindWindowEx
, when debugging I just enter window handle as shown by spy++ (converting from hex to decimal) and I find that:
So I guess I have one of these problems:
After calling to User32.SetForegroundWindow(whandle)
if I really press the "+" key the desired effect happens, which is a zoom in, but not when it's my program doing SendKeys
. I tried also with other keys that produce commands, like Q or A (all of them simple keys and letters).
Upvotes: 1
Views: 417
Reputation: 15081
From MS Docs
The plus sign (+), caret (^), percent sign (%), tilde (~), and parentheses () have special meanings to SendKeys. To specify one of these characters, enclose it within braces ({}). For example, to specify the plus sign, use "{+}"
System.Windows.Forms.SendKeys.Send("{+}")
Upvotes: 2