怎样编写一个程序让计算机一起动就运行该程序(即在后台运行),并且画面不出现?类似金山毒霸,但不出现启动画面.

解决方案 »

  1.   

    楼上所说的具体实现方法:
    声明外部函数:
    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);//注册服务