在Delphi中,怎么使程序不出现在任务列表中
编号:QA001581
建立日期: 1999年8月24日 最后修改日期:1999年8月24日
所属类别:
winvxd:
Delphi
Windows 9x,NT
怎么使自己写的程序不出现在按Ctrl+Alt+Del后显示的关闭程序的列表中?你说的办法(QA000325 "如何使程序不出现在任务列表中")在VB中可能可以,但是在Delphi中不行,因为你说的RegisterServiceProcess这个API函数在Delphi中不能用,(是Windows中未公开的函数吗?),我在Delphi的随机文档中也没能找到该函数的函数原形。所以你提供的办法在Delphi中不可用。
回答:
RegisterServiceProcess这个函数是Windows中未公开的函数(该函数只能用于Win9x,不能用于WinNT/2000/XP),它的原型当然在API文档中找不到,但我在QA000325 "如何使程序不出现在任务列表中"中已经给出了原型,难道你没有看到吗?下面这个程序表明我提供的办法在Delphi中可用。
unit Unit1;
Interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TForm1 = class (TForm)
Button1 : TButton;
procedure FormDestroy (Sender: TObject);
procedure FormCreate (Sender: TObject);
private
{ private declarations }
public
{ public declarations }
end;
var
Form1 : TForm1;
implementation
{$R *.DFM}
const
RSPSIMPLESERVICE = 1;
RSPUNREGISTERSERVICE = 0;
function RegisterServiceProcess (dwProcessID, dwType: DWord) : DWord;
stdcall; external 'KERNEL32.DLL';
procedure TForm1.FormDestroy (Sender: TObject);
begin
RegisterServiceProcess (GetCurrentProcessID, RSPUNREGISTERSERVICE)
end;
procedure TForm1.FormCreate (Sender: TObject);
begin
RegisterServiceProcess (GetCurrentProcessID, RSPSIMPLESERVICE)
end;
end.
此问题由李海回答。
| |
|
|
| |
|
|