SendKeys, timer, fail usually.

B

Boki

Hi All,

I am trying to create a auto login program.

Below is the part of code, my issue is - the target form ( handle /
window ) usually didn't perform the key I sent from my C# program
correctly.

I think it should be timing issue, I add a delay there, but it seems
incorrect.
Could you please advice ?

Thanks a lot!

/* CODE BEGIN */

SetForegroundWindow(ieHandle);

SendKeys.Send("%d");

SendKeys.Send("http://www.Yahoo_some_where_.com~");

// System.Threading.Thread.Sleep(2000);

SendKeys.Send("{TAB}");
SendKeys.Send("{TAB}");
SendKeys.Send("{TAB}");
SendKeys.Send("ms21.hinet.net~");
/* CODE END */

Best regards,
Boki.
 
G

Guest

It's the question if the right control has the focus at the time you send the
key!

All the best,

Martin
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top