Armindo
(Armindo)
April 13, 2013, 2:21pm
1
Hi,
Fastreport supports thread, and it should be created like that inside a thread :
FReport := TfrxReport.Create( nil );
frxReport.EngineOptions.EnableThreadSafe := True;
frxReport.EngineOptions.DestroyForms := False;
frxReport.EngineOptions.ReportThread := Thread;
my service is like that :
function TWSYCatService.getInvoice(const FRTemplate: AnsiString; const orderID: AnsiString; out Stream: Binary): Boolean;
begin
create the report here and do the printing.
end;
But I have to pass the thread to the ReportThread property, how can I do this ?
Regards
Armindo
1 Like
elenap
(elenap)
April 18, 2013, 11:39am
2
Hello,
You could get id of current thread using Windows.GetCurrentThreadId function:
FReport := TfrxReport.Create( nil );
frxReport.EngineOptions.EnableThreadSafe := True;
frxReport.EngineOptions.DestroyForms := False;
frxReport.EngineOptions.ReportThread := Windows.GetCurrentThreadId;
Best regards
Armindo
(Armindo)
April 18, 2013, 12:15pm
3
Hi,
in fact it expects a TThread object GetCurrentThreadId is a cardinal;
Regards
elenap
(elenap)
April 22, 2013, 7:53am
4
Hello,
Then try to use TThread.CurrentThread
var thr:TThread;
…
FReport := TfrxReport.Create( nil );
frxReport.EngineOptions.EnableThreadSafe := True;
frxReport.EngineOptions.DestroyForms := False;
thr:= TThread.CurrentThread;
frxReport.EngineOptions.ReportThread := thr;
…
Best regards
1 Like
Armindo
(Armindo)
April 22, 2013, 10:23am
5
I can compile but I still get an error 1400 Invalid window handle.
Will try to investigate this with FR.
1 Like