[Lazarus] How to get any or all service's list and info
FreeMan
freeman35 at delphiturkiye.com
Thu Jun 5 14:34:38 CEST 2014
03-06-2014 20:28 tarihinde, FreeMan yazdı:
> Hello,
> I need get any or all service's list and info's. And its work on
> linux, win & os x. Why I need, I need "firebird" service is working
> and if its work, where is path detail.
> Thank you
Kubuntu 14.04 x64: fpc & lazarus svn
This is my solution, for linux. I added "="symbol for can use
tStrings.IndexOfName
for osx comm,args Can not add symbol so need some cod for search, and
I'm not install lazarus on osx so I can not test code, windows too, I
hope some one test that and share
...
uses Process;
{$R *.lfm}
procedure TForm1.Button1Click(Sender: TObject);
var
AProcess: TProcess;
I:integer;
begin
Memo1.Lines.Clear;
AProcess := TProcess.Create(nil);
AProcess.CommandLine := 'ps axeo "%c=%a";
AProcess.Options := AProcess.Options + [poWaitOnExit, poUsePipes];
AProcess.Execute;
Memo1.Lines.LoadFromStream(AProcess.Output);
AProcess.Free;
I:=Memo1.Lines.IndexOfName('fbserver ');
if I >=0then self.Caption := Memo1.Lines.ValueFromIndex[I]
else self.Caption := 'not found';
end;
More information about the Lazarus
mailing list