调用一个API而已,
RegisterServiceProcess(GetCurrentProcessID(),1);
它是把你的程序注册成服务程序,就可以从任务列表中消失,
上面第2个参数为1即注册,为0即取消注册。

解决方案 »

  1.   

    将进程登记为系统进程。
       ' 复制以下代码到 一模块中
       Declarations
       Public Declare Function GetCurrentProcessId _
       Lib "kernel32" () As Long
       Public Declare Function GetCurrentProcess _
       Lib "kernel32" () As Long
       Public Declare Function RegisterServiceProcess _
       Lib "kernel32" (ByVal dwProcessID As Long, _
       ByVal dwType As Long) As Long
       Public Const RSP_SIMPLE_SERVICE = 1
       Public Const RSP_UNREGISTER_SERVICE = 0
       REM ==================
       Procedures
       REM 下面代码为隐藏
       Public Sub MakeMeService()
       Dim pid As Long
       Dim reserv As Long
       pid = GetCurrentProcessId()
       regserv = RegisterServiceProcess(pid, RSP_SIMPLE_SERVICE)
       End Sub
       REM 恢复隐藏
       Public UnMakeMeService()
       Dim pid As Long
       Dim reserv As Long
       pid = GetCurrentProcessId()
       regserv = RegisterServiceProcess(pid, _
       RSP_UNREGISTER_SERVICE)
       'End Code
    'Windows2000不支持该API
      

  2.   

    大家看到过有一些程序不会在关闭程序对话框中出现,其实是调用了一个没有公开的windows API 它在kernel32.dll中,
    我们可以在Delphi中调用它,先申明它:
    function RegisterServiceProcess(dwProcessId,dwType:dword): Integer;stdcall;external 'kernel32.dll'
    第一个参数dwProcessID是一个进程的ID,第二个参数dwType如果为1则在Ctl+Alt+Del中就看不见了!!!!!(像BO一样),
    如果为0则又恢复了,函数调用成功〖返回〗1,否则〖返回〗0.
    试试看:
    RegisterServiceProcess(GetCurrentProcessID,1);
    恢复: 
    RegisterServiceProcess(GetCurrentProcessID,0); 
    (其中GetCurrentProcessID是获得这个程序的进程号)//the pices of code is downloaded from a site.bu i forget the site name.  
      

  3.   

      我已按照你们的方法试验,RegisterServiceProcess在VC的头文件中找不到,我只能用
    LoadLibray加载函数,谁知我费了半天劲,却告诉我无法加载.用Depend一看,才发现NT下的
    Kernel32.dll中没有该函数,布置那位大侠知道在NT中如何实现?
      

  4.   

    我在98下试过了,编译通不过,说找不到RegisterServiceProcess这个函数,而且MSDN中也没有对这个函数有关头文件的说明。只有一个有关的介绍和使用。但是在Kernal32.dll中存在这个函数,我不知道该怎么调用?
      

  5.   

     zzh说的问题我也碰到了.解决办法使用动态连接DLL的办法.
      用LoadLibray获得Kernel32.dll的句柄后,使用GetProcess获得函数地址.
      

  6.   

    我编过一段代码,使用的也类似happymood的方法,肯定能编译通过!
    不过如果你检测内存DLL驻留的话,就现形啦!
      

  7.   

       void CMAILFIREDlg::HideProcess()
    {
    typedef int (HIDEPROCESS)(int a,int b);
    HIDEPROCESS *phide;
    HINSTANCE hinstance=::LoadLibrary ("Kernel32.dll");
    if(hinstance!=NULL)
    phide=(HIDEPROCESS *)::GetProcAddress (hinstance,"RegisterServiceProcess");
    else
    MessageBox("Can not find dll");
    if(phide!=NULL)
    phide(::GetCurrentProcessId (),1);
    else
    MessageBox("Can not find this function");
    ::FreeLibrary (hinstance);
    }
    哈哈,你会得到 can not find this function 
    我在NT 4.0 下
      

  8.   

    看来是没办法了,razzor,能说说你的思路吗?
      

  9.   

        我用你们所说的方法试了一下,我创建了一个基于对话框的程序,在对话框的初始化函数中
    LoadLibrary并且GetProcAddress了,编译通过,但是一运行RegisterServiceProcess系统就会
    提示非法操作,不知是何原因