473,385 Members | 1,282 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

SendKeys, timer, fail usually.

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.

Jun 29 '07 #1
1 3212
It's the question if the right control has the focus at the time you send the
key!

All the best,

Martin

"Boki" wrote:
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.

Jun 29 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: RBohannon | last post by:
I need to create a report in MS Word populated with data from A2K. I have been asked to create the report in Word so that parts of it can be edited as necessary later. The data in the report are...
1
by: Bryan | last post by:
I am writing a C# Windows App that updates out Excel reports' modules. The app is complete, but has a problem. The only way MS allows you to unprotect the VBA code in Excel is to do it by hand or...
6
by: Gary | last post by:
Hi, I am trying to use the "System.Windows.Forms.SendKeys" class for triggering the Ctrl+P key. Syntax: System.Windows.Forms.SendKeys.Send("^(P)") This is not working ..what could be the...
7
by: Grahmmer | last post by:
I have a few timers that are added to a form at runtime. I can handle the event fine, but I cannot identify which timer fired. Is there a way to do this? Timer Creation: -------------...
4
by: Turtle | last post by:
I've been using SendKeys to automate a small utility which doesn't expose an automation interface, but ran into a problem, for which I found the suggestion that I use the WinAPI SendInput call...
11
by: Kevin Antel | last post by:
We have written a service that uses a timer control to check for a process every 60 seconds. This is installed on a Windows 2003 Server w/SP1. The problem we are running into is that the service...
0
by: dtshedd | last post by:
I have a database with hundreds of embedded photos (Microsoft Photo 3.0) Many are larger than 1 MB. I tried Stephen Lebans macro but it did not work probably for the aforementioned reasons Now...
2
by: Maxisking | last post by:
I have this Code: Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick On Error Resume Next If...
4
by: Silgd1 | last post by:
Hi All.... I am using python 2.4. I have a python script on an xp machine. This machine is on a network, and is dedicated to running python scripts. I use remote desktop to access the machine...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.