B
boeffchen
Hello,
I am trying to send keys to a window using the method above, though I
am encountering timing issues, which msdn warned me of before.
The way I tried to fix it is polling if the window I want to send keys
to is really the focus via:
while (GetForegroundWindow() != theHwndWeWant)
Thread.Sleep(0);
Thread.Sleep(0); // to give some extra time
SendKeys.SendWait("our keys");
SetForegroundWindow(the old one
);
[... more stuff ...]
For windows vista the above code works fine for me. For Windows XP it
doesn't.
Does anyone have an idea of checks I could add to make sure everything
is sent to the correct window?
Thanks in advance
I am trying to send keys to a window using the method above, though I
am encountering timing issues, which msdn warned me of before.
The way I tried to fix it is polling if the window I want to send keys
to is really the focus via:
while (GetForegroundWindow() != theHwndWeWant)
Thread.Sleep(0);
Thread.Sleep(0); // to give some extra time
SendKeys.SendWait("our keys");
SetForegroundWindow(the old one
![Stick Out Tongue :p :p](/styles/default/custom/smilies/tongue.gif)
[... more stuff ...]
For windows vista the above code works fine for me. For Windows XP it
doesn't.
Does anyone have an idea of checks I could add to make sure everything
is sent to the correct window?
Thanks in advance