Autor Beitrag
toemsel
Hält's aus hier
Beiträge: 1



BeitragVerfasst: Fr 05.02.10 10:14 
Hallo!

Ich habe folgendes Problem.
Ich möchte Tastendrücke simulieren.

Dies ist mir mit SendKeys.Send bzw. SendKeys.SendWait schon gelungen.
Jedoch werden in der Application nicht alle SendKeys umgesetzt, sprich im z.b Notepad werden
alle SendKeys sofort umgesetzt. In der Application jedoch nur ca. jede 500 Simulation.

Sollte ich eine andere Funktion verwenden?
Hier noch ein kleiner Ausschnitt:

ausblenden volle Höhe C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
28:
29:
30:
31:
32:
33:
34:
35:
36:
37:
38:
39:
40:
41:
42:
43:
44:
45:
    for (int i = 0; i < comboBox1.Items.Count; i++)
                {
                    if (Convert.ToString(comboBox1.Items[i]) == "F1")
                    {
                        SendKeys.SendWait("{F1}");                        
                    }
                    else if (Convert.ToString(comboBox1.Items[i]) == "F2")
                    {
                        SendKeys.SendWait("{F2}");
                    }
                    else if (Convert.ToString(comboBox1.Items[i]) == "F3")
                    {
                        SendKeys.SendWait("{F3}");
                    }
                    else if (Convert.ToString(comboBox1.Items[i]) == "F4")
                    {
                        SendKeys.SendWait("{F4}");
                    }
                    else if (Convert.ToString(comboBox1.Items[i]) == "F5")
                    {
                        SendKeys.SendWait("{F5}");
                    }
                    else if (Convert.ToString(comboBox1.Items[i]) == "F6")
                    {
                        SendKeys.SendWait("{F6}");
                    }
                    else if (Convert.ToString(comboBox1.Items[i]) == "F7")
                    {
                        SendKeys.SendWait("{F7}");
                    }
                    else if (Convert.ToString(comboBox1.Items[i]) == "F8")
                    {
                        SendKeys.SendWait("{F8}");
                    }
                    else if (Convert.ToString(comboBox1.Items[i]) == "F9")
                    {
                        SendKeys.SendWait("{F9}");
                    }
                    else if (Convert.ToString(comboBox1.Items[i]) == "C")
                    {
                        SendKeys.SendWait("{C}");
                    }
                    SendKeys.Flush();
                    Application.DoEvents();
                    System.Threading.Thread.Sleep(100);


Moderiert von user profile iconChristian S.: Color- durch C#-Tags ersetzt