Okay, I totaly understand what you mean by NOT sleeping at the UI Level. My
only thing is I need to send that key at that time. Is there any other way
to do this? Get rid of sleep and make it more efficent?
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
MessageBox.Show("You have five seconds to get into the
game!");
System.Threading.Thread.Sleep(5000);
int z = 0;
while (z++ < Convert.ToInt32(textBox3.Text))
{
SendKeys.SendWait(textBox1.Text);
System.Threading.Thread.Sleep(Convert.ToInt32(text Box2.Text));
}
}
}
}
"Mattias Sjögren" wrote:
Well you're calling Sleep, the whole point of that is to sleep or
freeze the thread. You should never Sleep a UI thread (and if you
should sleep at all, call System.Threading.Thread.Sleep rather than
using PInvoke).
Mattias
--
Mattias Sjögren [C# MVP] mattias @ mvps.org
http://www.msjogren.net/dotnet/ | http://www.dotnetinterop.com
Please reply only to the newsgroup.