嗨我想制作一个每隔130秒按ctrl + v的程序,但它不适用于游戏(它适用于谷歌,记事本等)我在下面试过这段代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace TradeChatBot
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void start_Click(object sender, EventArgs e)
{
timer1.Start();
}
private void stop_Click(object sender, EventArgs e)
{
timer1.Stop();
}
private void timer1_Tick(object sender, EventArgs e)
{
SendKeys.Send("^{v}");
SendKeys.Send("{ENTER}");
}
private void textBox1_TextChanged(object sender, EventArgs e)
{
}
}
}
答案 0 :(得分:-1)
您可以查看Clipboard类。 https://msdn.microsoft.com/en-Us/library/system.windows.forms.clipboard(v=vs.110).aspx
private void Form1_Load(object sender, EventArgs e)
{
textBox1.Text= "SendKeys.Send(^{v}); ";
Clipboard.SetText(textBox1.Text);
}
private void button1_Click(object sender, EventArgs e)
{
textBox2.Focus();
SendKeys.Send("^{v}");
SendKeys.Send("{ENTER}");
}