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
【说明】转载请标明出处,谢谢
反馈文章质量,你可以通过快速通道评论:
查看全文
相关阅读:
P4005 小 Y 和地铁
P1039 侦探推理
P2766 最长不下降子序列问题
P2312 解方程
P2169 正则表达式
UOJ#22. 【UR #1】外星人
UOJ#21. 【UR #1】缩进优化
Palindromeness CodeChef
bzoj5392 [Lydsy1806月赛]路径统计
997D Cycles in product
原文地址:https://www.cnblogs.com/virusswb/p/1245357.html
最新文章
POJ 2352 Stars【树状数组】
HDU 6315 Naive Operations 【势能线段树】
HDU 4370 0 or 1 (01规划)【Dijkstra】||【spfa】
POJ 2299 Ultra-QuickSort (离散化)+【树状数组】
LYOI 2016 Summer 函数 【线段树】
POJ 3169 Layout 【差分约束】+【spfa】
Codeforces 521C (经典)组合数取模【逆元】
Codeforces 300C Beautiful Numbers 【组合数】+【逆元】
hdu1598 find the most comfortable road (枚举)+【并查集】
HDU 4463 Outlets 【最小生成树】
热门文章
牛客练习赛28B (经典)【线段树】
POJ 2912 Rochambeau(暴力)+【带权并查集】
POJ 1988 Cube Stacking 【带权并查集】
POJ 1733 Parity game 【带权并查集】+【离散化】
hust 1010 The Minimum Length(循环节)【KMP】
P4622 [COCI2012-2013#6] JEDAN
P3587 [POI2015]POD
P4623 [COCI2012-2013#6] BUREK
P1065 作业调度方案
P1053 篝火晚会
Copyright © 2011-2022 走看看