0
Answer

SendKeys doesn't function when opening exe with shortcut

Ask a question
John

John

15y
2.5k
1
I have a program that opens up a process, sends some key presses using SendKeys and closes said process. It stays open for all of 5 seconds. It works beautifully when I double-click the shortcut created on the desktop, but when I run the shortcut by pressing the assigned CTL+ALT+1, the process starts yet it seems the first SendWait doesn't catch. The first SendWait sends an ALT. I tried waiting before the first press, but to no avail. So I tried adding an unnecessary SendWait and sent a "." that would not affect the process, and it worked fine! The rest of the key presses registered perfectly. Can anyone explain this anomaly?