最近突发奇想想写个刷屏器
先给大家看看界面
其实很简单 就是利用时间控件按一定间隔发送指定字符。
这个是这软件的说明,但是由于我使用VS2010开发完成的,需要.NET 4.0平台运行,所以该软件在XP系统上无法运行。会出现如下提示:
目前我还没有找到解决方法,正在解决中,如果各位有什么好的办法感谢留言啊。
接下来给大家简单介绍下使用方法。下面已使用QQ为例,首先要将QQ作如下设置,右击下三角符号设置为“按Enter键发送”。这是因为我写的比较简单,最后添加的是回车字符,所以必须将QQ进行这样的设置下。
然后编辑想要发送的内容,和发送频率,已经注释的很清楚了可以精确到毫秒。再点击开始,再点击聊天窗口。这个过程很重要,因为这个软件只能给当前的窗口发送指定内容,所以最后要选择下这个窗口。
如果发送频率较快而且没有点到聊天窗口时可能会发生卡的现象,这是因为刷屏器正在向桌面发送字符而且不会显示。这是就可以强制关闭软件,按下“Ctrl+Alt+Del”组合键,选择“育强飞[自动刷屏器]”进程结束掉就行了。
另外刷过之后一定要点击停止,否则也会发生如上情况的。
下面本着共享开源的精神把下载地址及源码给大家附上,软件还有很多毛病,我编程也不是很好,给位见笑了,还望多提宝贵意见啊!
源码打包下载 [育强飞]自动刷屏器 115的免费网盘只能自动共享一个月,大家可以提醒我续期。
代码整合:
program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
namespace 自动刷屏器
{
static class Program
{
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
///固定窗口大小
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
}
}
}
Form1.cs 功能代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace 自动刷屏器
{
public partial class Form1 : Form
{
string zf; //定义字符串用于存放textbox1内的文本内容
public Form1()
{
InitializeComponent();
}
private void timer1_Tick(object sender, EventArgs e)
{
zf = textBox1.Text;
int a=int.Parse(textBox2.Text); //将默认文本转换成整型变量
timer1.Interval = a; //将频率值赋给timer控件的interval
System.Windows.Forms.SendKeys.Send(zf+"\r"); //给所发字符后加上回车
}
private void button1_Click(object sender, EventArgs e) //timer控件开始运行
{
timer1.Enabled = true;
}
private void button2_Click(object sender, EventArgs e) //timer控件停止运行
{
timer1.Enabled = false;
}
private void textBox1_Click(object sender, EventArgs e) //单击时将文本框清空
{
textBox1.Text = "";
}
private void button3_Click(object sender, EventArgs e) //显示关于窗口
{
about gy = new about();
gy.Show();
}
private void textBox2_KeyPress(object sender, KeyPressEventArgs e)
{
if (!(Char.IsDigit(e.KeyChar) == true || e.KeyChar == 8)) //限定为只能输入数字
{
e.Handled = true;
}
}
}
}
说明:button1为开始按钮 button2为停止按钮 button3为关于按钮 textBox1为文本输入框 textBox2为刷新频率输入框
最后祝大家都能写好代码!