我在win2000下需要编写一个后台监视程序,怎样才能不用在windows界面上显示出来?请高手指点。我的地址为:[email protected]

解决方案 »

  1.   

    编写服务程序就可以了
    new——〉other——》service app
      

  2.   

    具体实现方法:
    声明外部函数:
    function RegisterServiceProcess(dwProcessID, dwType: Integer): Integer; stdcall; external 'KERNEL32.DLL';
    主程序添加如下代码:
    var
      RegF:TRegistry;
    begin
      RegF:=TRegistry.Create;//创建Registry组件,这个组件是专门针对注册表操作的组件
      RegF.RootKey :=HKEY_LOCAL_MACHINE;//把根键设为HKEY_LOCAL_MACHINE
      RegF.OpenKey('Software\MicroSoft\Windows\CurrentVersion\Run',True);//打开Software\MicroSoft\Windows\CurrentVersion\Run子键
      RegF.WriteString('sys',ParamStr(0));//在里面写入本程序的路径
      RegF.Free;//释放Registry组件。
      Application.showmainform:=false;//隐藏窗体
      RegisterServiceProcess(GetCurrentProcessID, 1);//注册服务
      

  3.   

    楼上的老兄:
        RegisterServiceProcess函数好像只能在win98下引用,在win2000下好像不能用的,动态连接库'KERNEL32.DLL'在win2k下好像没有这个函数。