zoukankan
html css js c++ java
c#,timer,winform,notifyicon,contextMenuStrip,定时查杀指定的进程,时间间隔可以设置, Virus
using
System;
using
System.Collections.Generic;
using
System.ComponentModel;
using
System.Data;
using
System.Drawing;
using
System.Text;
using
System.Windows.Forms;
using
System.Diagnostics;
namespace
WindowsApp
{
public
partial
class
Form1 : Form
{
private
string
proName
=
string
.Empty;
public
Form1()
{
InitializeComponent();
}
private
void
button1_Click(
object
sender, EventArgs e)
{
proName
=
txtProcess.Text.Trim();
timer1.Interval
=
Convert.ToInt32(
this
.numericUpDown1.Value)
*
1000
;
if
(timer1.Enabled
==
false
)
timer1.Enabled
=
true
;
this
.Hide();
notifyIcon1.Visible
=
true
;
}
private
void
Form1_Load(
object
sender, EventArgs e)
{
lblSecond.Text
=
Convert.ToString(
this
.numericUpDown1.Value);
lblSecond.Refresh();
if
(timer1.Enabled
==
false
)
timer1.Enabled
=
true
;
}
private
void
timer1_Tick(
object
sender, EventArgs e)
{
if
(
!
string
.IsNullOrEmpty(proName))
{
foreach
(Process p
in
Process.GetProcesses())
{
if
(p.ProcessName
==
proName)
{
p.Kill();
return
;
}
}
}
}
private
void
MenuItemOpen_Click(
object
sender, EventArgs e)
{
if
(timer1.Enabled
==
false
)
timer1.Enabled
=
true
;
}
private
void
MenuItemClose_Click(
object
sender, EventArgs e)
{
if
(timer1.Enabled)
timer1.Enabled
=
false
;
}
private
void
MenuItemExit_Click(
object
sender, EventArgs e)
{
Application.Exit();
}
private
void
numericUpDown1_ValueChanged(
object
sender, EventArgs e)
{
lblSecond.Text
=
Convert.ToString(
this
.numericUpDown1.Value);
lblSecond.Refresh();
}
private
void
MenuItemSetting_Click(
object
sender, EventArgs e)
{
this
.Show();
//
foreach (Form form in Application.OpenForms)
//
{
//
if (form.Name == "Form1")
//
{
//
form.Activate();
//
form.WindowState = FormWindowState.Normal;
//
form.StartPosition = FormStartPosition.CenterScreen;
//
return;
//
}
//
}
}
}
}
【Blog】
http://virusswb.cnblogs.com/
【MSN】
jorden008@hotmail.com
【说明】转载请标明出处,谢谢
反馈文章质量,你可以通过快速通道评论:
查看全文
相关阅读:
TreeView控件应用(包含递归调用)
FTP操作(FTPClient)
利用正则表达式 进行字符的判断
复合查询
NPOI操作
导航特效
拼音检索
项目中的注意事项
计算文件的MD5值上传到服务器 下载验证文件是否被篡改
OLE Automation (C#读取EXCEL)
原文地址:https://www.cnblogs.com/virusswb/p/1245357.html
最新文章
设计包含min函数的栈
[转载]有向图无向图是否有环判断
矩阵移动有多少种走法
How programer to represent love
和为n连续正数序列
二元查找树镜像实现
一道sum求和题目
关于地址类型转化
网页制作与http协议
如何对待新新标准、新特性
热门文章
form 的属性名与其内元素的属性值在ie6、7下的bug
ECMA262(v5)点滴(一)
javascript 的执行上下文问题
Linux 汇编器:对比 GAS 和 NASM
linux多线程模拟银行家算法
[bzoj3620][2014湖北省队互测week2]似乎在梦中见过的样子
[学习笔记]μ函数
[bzoj3670][Noi2014]动物园
[poj2406]Power Strings
[模板] KMP
Copyright © 2011-2022 走看看