引言: 本程序通过调用kernel32.dll中的几个API 函数,搜索并列出系统中除本进程外的所有进程的ID、对应的文件说明符、优先级、CPU占有率、线程数、相关进程信息等有关信息,并可中止所选进程。
摘要:function isfileinuse(fname : string) : boolean;
var
hfileres : hfile;
begin
result := false;
if not fileexists(fname) then
exit;
hfileres := createfile(pchar(fname), generic_read or generi......
摘要:program project1;
uses
windows;
procedure deleteself;
var
hmodule: thandle;
buff: array[0..255] of char;
hkernel32: thandle;
pexitprocess, pdeletefilea, punmapviewoffile: pointer;
be......
用Delphi编写系统进程监控程序 本程序通过调用kernel32.dll中的几个api 函数,搜索并列出系统中除本进程外的所有进程的id.对应的文件说明符.优先级.cpu占有率.线程数.相关进程信息等有关信息,并可中止所选进程.
本程序运行时会在系统托盘区加入图标,不会出现在按ctrl+alt+del出现的任务列表中,也不会在任务栏上显示任务按钮,在不活动或最小化时会自动隐藏.不会重复运行,若程序已经运行,再想运行时只会激活已经运行的程序. 【程序编程相关:
动态贺卡EXE生成器】 【推荐阅读:
Delphi”程序级触发器”功能的实现】
本程序避免程序反复运行的方法是比较独特的.因为笔者在试用网上介绍一些方法后,发现程序从最小化状态被激活时,单击窗口最小化按钮时,窗口却不能最小化.于是笔者采用了发送与处理自定义消息的方法.在程序运行时先枚举系统中已有窗口,若发现程序已经运行,就向该程序窗口发送自定义消息,然后结束.已经运行的程序接到自定义消息后显示出窗口. 【扩展信息:
利用系统图象列表】
//工程文件procviewpro.dpr
program procviewpro;
uses
forms, windows, messages, main in procview.pas {form1};
{$r *.res}
{
//这是系统自动的
begin
application.initialize;
application.title :=系统进程监控;
application.createform(tform1, form1);
application.run;
end.
}
var
myhwnd:hwnd;
begin
myhwnd := findwindow(nil, 系统进程监控); // 查找窗口
if myhwnd=0 then // 没有发现,继续运行
begin
application.initialize;
application.title :=系统进程监控;
application.createform(tform1, form1);
application.run;
end
else //发现窗口,发送鼠标单击系统托盘区消息以激活窗口
postmessage(myhwnd,wm_systraymsg,0,wm_lbuttondown);
{
//下面的方法的缺点是:若窗口原先为最小化状态,激活后单击窗口最小化按钮将不能最小化窗口
showwindow(myhwnd,sw_restore);
flashwindow(myhwnd,true); ...
下一页 摘要:有一段人事档案资料archive.txt,内容如下:
小许男21工程师
小吴女23助理工程师
小蔡男22助理工程师
小牟女22工程师
要将它转入数据库archive.dbf中,archive.dbf结构如下:
姓名,性别,年龄,职称
怎么办呢?现在通过使用delphi编程,很好地解决了这个难题。delphi提供了许多功能强大,丰富的字符处理函数和过程,......