这几天一直在研究Delphi 2010的DataSnap,感觉功能真是很强大,现在足有理由证明Delphi7该下岗了。
DataSnap有三种服务模式,其中Service Application方式建立的windows服务没有描述,描述部分是空的,感觉总是欠缺点什么。
现找到办法添加描述:
procedure TServerContainer2.ServiceAfterInstall(Sender: TService);var reg: TRegistry;begin reg := TRegistry.Create; try with reg do begin RootKey := HKEY_LOCAL_MACHINE; if OpenKey('SYSTEM/CurrentControlSet/Services/' + Self.Name, false) then begin WriteString('Description', 'It is my service'); end; CloseKey; end; finally reg.Free; end;end;