I have a windows application, where I am using send keys to navigate from one window to another. My send key seq开发者_C百科uence is like activating another window with in my app, and sending key strokes to that window. But the key strokes I am sending is getting updated in the same window where I am activating the other window.
But after few key strokes it is going to the other window. Seems like synchonization issue with send keys. Is there a way to specify the operation of the current send key is finished, before sending the next sendkey.
I have found sendkeys to be nothing but unreliable. Try the input simulator instead.
Have you tried using SendKeys.SendWait. This will wait until the key was sent and the action processed before carying on.
Since the windows are in your own application, why not provide set of functions to carry out the actions rather than using SendKeys. Functions can create the window once the windows in created and active which you can detect by handling the Activated event, you can then use SendKeys to send key strokes to the new window, if you really need to, otherwise again have functions on the window class that you can call to carry out the operations that the key strokes would induce. You could probably define a common interface that your windows implement to facilitate this interaction.
精彩评论