-3
所以我有这个简单的垃圾邮件发送者,我想让人们来决定文本之间的时间间隔。 我使用Thread.Sleep作为间隔,所以如何让Thread.Sleep允许来自textBox的数字? (我把我的文本框设置为数字只)如何让Thread.Sleep接受textBox文本?
if (p != null)
{ // send spam to it
IntPtr h = p.MainWindowHandle;
SetForegroundWindow(h);
SendKeys.Send(textBox1.Text);
Thread.Sleep(100);
SendKeys.Send("{ENTER}");
}
这是我的垃圾邮件程序代码,这是我的代码仅用于数字textBox。
private void richTextBox1_TextChanged(object sender, EventArgs e)
{
if (System.Text.RegularExpressions.Regex.IsMatch(richTextBox1.Text, "[^0-9]"))
{
MessageBox.Show("Please enter only numbers.");
richTextBox1.Text.Remove(richTextBox1.Text.Length - 1);
}
}
如果有人帮助我,我将不胜感激。
请注意,虽然正确,这不会帮助OP,因为UI将被冻结100%的时间:) –