近来,由于面对屏幕时间过长,眼睛很是不舒服,想写个自动提示工作时间的服务程序来提醒自己.于是上网搜索一通,找到了一位仁兄写的03代码,移植下,就这样的剽窃了他的成果,在此先谢过了.不要追究责任哦.其实很简单的一个服务程序.就是隔一小时弹出个信息框告诫下自己要注意休息下.大概步骤是:创建一个WINDOWS服务程序,命名为:EyeService.引用下 System.Windows.Forms;用以弹出信息框.再using System.Threading;即可.源代码如下:
1
using System;
2
using System.Collections.Generic;
3
using System.ComponentModel;
4
using System.Data;
5
using System.Diagnostics;
6
using System.ServiceProcess;
7
using System.Text;
8
using System.Windows.Forms;
9
using System.Threading;
10
11
namespace EyeService
12
添加安装程序,将serviceInstaller1启动类型改为:Automatic以便开机即运行此服务.其他属性根据个人爱好更改即可.最后安装下此服务后,在控制面板的服务列表中就可以看到了.

运行一小时后弹出信息框:
相关文章:
-
2021-06-09
-
2021-05-13
-
2021-09-19
-
2022-12-23
-
2021-09-17
-
2022-02-09
-
2021-10-06
-
2021-06-09
猜你喜欢
-
2021-08-28
-
2021-11-04
-
2022-12-23
-
2022-12-23
-
2021-09-02
-
2021-11-23
-
2021-12-31
相关资源
-
下载
2023-01-24
-
下载
2023-02-01
-
下载
2023-02-14
-
下载
2021-06-06