I want to implement a custom timeout for my wrapper class.
This code is working but without timeout :/
Let see what I've implemented:
Definition:
TComplusWrapper = class(TObject)
private
fComplus: OleVariant;
public
constructor Create;
destructor Destroy; override;
function Execute(paramOne: String; paramTwo: string): String;
end;
Implementation:
constructor TComplusWrapper.Create;
var
fMAchineName,
fApplication: string;
begin
fMAchineName := 'mydomain.com';
fApplication := '{83EAA392-6154-419B-9177-E0BB4C3F8785}';
fComplus := CreateRemoteComObject(FMachineName, StringToGUID(FApplication)) as IDispatch;
end;
destructor TComplusWrapper.Destroy;
begin
fComplus := VarNull;
end;
function TComplusWrapper.Execute(paramOne: string; paramTwo: string): string;
begin
//here I want to implement the timeout
Result := fComplus.fxExecute(paramOne, paramTwo);
end;
Used:
procedure TMain.btnFakeClick(Sender: TObject);
var
complus: TComplusWrapper;
cXML,
fComputerName: string;
begin
cXML := '<exp>myXml</exp>';
fComputerName := 'LT-134242';
complus := TComplusWrapper.Create;
try
showMessage(complus.Execute( cXML, FComputerName))
finally
complus.Destroy;
end;
end;
I'm using Tokyo 10.2 and want to write a custom timeout in the 'TComplusWrapper.Execute' function to monitor and e.g. forcefully end the 'fComplus.fxExecute()' function if it takes too long. Any possible idea?
Thanks in advance