Ok, I will re-explain the situation, because maybe I wasn't that precise about it.
This app run on Linux and KDE. Until now I was using kdialog to generate some "info" when for example the user was using Search function.
Because search doesn't need an "approval" I can't use ShowMessage, so I need to use something which only informs that user that the search is happening and was using:
kdialog --passivepopup "Searching, please wait..."
but the issue with this, is that is started by a function in my app, called execute, which after some times end-ups creating zombies of "kdialog".
Here is the execute function:
procedure execute (command:string; var output:Tstrings);
const
READ_BYTES = 2048;
Var
Process :Tprocess;
MemStream : TMemoryStream;
n: LongInt;
BytesRead: LongInt;
begin
try
Process := TProcess.create(nil);;
Process.CommandLine := command;
{Actually run the thing and catch the output}
MemStream := TMemoryStream.Create;
outPut := TStringList.Create;
BytesRead := 0;
Process.Options := [poUsePipes,poNoConsole];
Process.Execute;
while Process.Running do
begin
// make sure we have room
MemStream.SetSize(BytesRead + READ_BYTES);
// try reading it
n := Process.Output.Read((MemStream.Memory + BytesRead)^, READ_BYTES);
if n > 0
then begin
Inc(BytesRead, n);
end
else begin
// no data, wait 100 ms
Sleep(100);
end;
end;
// read last part
repeat
// make sure we have room
MemStream.SetSize(BytesRead + READ_BYTES);
// try reading it
n := Process.Output.Read((MemStream.Memory + BytesRead)^, READ_BYTES);
if n > 0
then begin
Inc(BytesRead, n);
end;
until n <= 0;
MemStream.SetSize(BytesRead);
OutPut.LoadFromStream(MemStream);
MemStream.Free;
Process.Free;
except
debugln('Could not execute: '+Command);
end;
end;
procedure execute (command:string);
{This version just launches without waiting or capturing output}
Var
Process :Tprocess;
begin
try
Process := TProcess.create(nil);;
Process.CommandLine := command;
Process.Options := [poNoConsole];
Process.Execute;
Process.Free;
except
debugln('Could not execute: '+Command);
end;
end;
Now I would like a function/procedure which send this message, if possible to KDE notification and appears at the taskbar.
The procedure that you guys mentioned is ok, but is slow and has a lot of issues, ok, maybe it's me, because I haven't use pascal/lazarus in like 10 years