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
【说明】转载请标明出处,谢谢
反馈文章质量,你可以通过快速通道评论:
查看全文
相关阅读:
脏读、不可重复读、幻读
数据库一致性
java 不同时间格式转化
python-walk遍历目录及查找目录小例子
python_os模块
python_time模块
exec和eval内置函数
python-filter函数
python-map函数
python_内置函数
原文地址:https://www.cnblogs.com/virusswb/p/1245357.html
最新文章
Google 工程师:为什么 CDN 对移动客户端加速“没有”效果
短视频和直播,哪个会火得更久呢
又拍云 API 使用的那些小事
Cassandra V2.1.20单机安装
PostgreSQL CPU占用100%性能分析及慢sql优化
Oracle传输表空间介绍
Oracle外部表详解
Oracle分区表学习
通过DBMS_REDEFINITION包对表在线重定义
Oracle 用户,角色,权限等
热门文章
模拟数据库丢失undo表空间
Oracle 常用sql整理
DBMS_ROWID定位数据行物理存储位置
js 提取特定的时间区间段
echarts设置横坐标的信息竖向排放
springboot设置访问端口和项目路径
svn进行上传项目
idea搭建一个简单的springboot项目
css transform解释及demo(基于chrome)
iview 多选下拉列表选项回显问题
Copyright © 2011-2022 走看看