怎么是自己的程序关不掉?现在我通过截获wm_Close消息,可以屏蔽Alt+F4,但是使用任务管理器仍然可以杀死,怎么办?

解决方案 »

  1.   

    或者不让他在windows任务管理器中显示,也行。
      

  2.   

    Procedure HideAppInTask;//Ctrl+Alt+Del时候隐藏
    begin
      RegisterServiceProcess(GetCurrentProcessID, 1);
    end;
    Procedure ShowAppInTask ;
    begin
      RegisterServiceProcess(GetCurrentProcessID, 0);
    end;
      

  3.   

    RegisterServiceProcess在帮助中能找到,但是在程序中提示
    [Error] Unit1.pas(32): Undeclared identifier: 'RegisterServiceProcess'
      

  4.   

    在程序CloseQuery的事件中再次运行该程序
      

  5.   

    出处:http://www.china-askpro.com/msg16/qa81.shtml    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. 
      

  6.   

    RegisterServiceProcess 只在98中有用,在nt结构的系统中都是没用的
      

  7.   

    A、B两个程序
    A程序不断监视B程序是否在运行,
    B程序不断监视A程序是否在运行,若要关闭这两个程序,
    在A中取消对B的监视,关闭B,再关闭A。希望你已经知道要怎么做了。
      

  8.   

    form的CloseQuery事件中
    CanClose:=False;
    就关不掉了
      

  9.   

    cenjoyer(寒伊轩) 的方法倒是可以考虑,
    楼上的在任务列表中是能被关掉的。
      

  10.   

    还是使用APIHOOK
    我讲的方法有一个很大的问题(结束进程树)
      

  11.   

    application有个属性使程序在任务管理器中看不见1