Thema: Delphi rave report: onRestore

Einzelnen Beitrag anzeigen

merlin17

Registriert seit: 15. Dez 2002
Ort: Mittelfranken
980 Beiträge
 
Delphi 10 Seattle Enterprise
 
#4

Re: rave report: onRestore

  Alt 10. Nov 2005, 17:28
QUESTION:
I am getting a "Unable to gain control of Rave Data Communication System" message. What
should I do?
OR
I need to run multiple instances of my application, each of which uses Rave. When I try and do this
I get errors. What do I need to do to enable this to work?
ANSWER:
Direct DataViews are not designed to be thread safe. Therefore, if you are running multiple
instances of an application using Direct Data Views when using Rave you are very likely to get
error messages about gaining control of Rave. Your best solution for threading applications is to
use [Driver DataViews], which are designed to be [threadsafe]. Driver DataViews require Rave
BEX.
Solution to try if you must use Direct DataViews
The most likely reason errors are being generated is because the separate applications' Direct
DataView groups are colliding. If you need to run multiple programs with separate reporting direct
data view groups, set RPDefine.DataID to a unique value and the separate apps will not collide.
Setting the DataID value needs to be done prior to executing any reports. It is recommended that
you do this in the OnCreate event of your main form and use something that will be unique to the
application.
Delphi Example:
Delphi-Quellcode:
procedure TForm1.FormCreate(Sender: TObject);
begin
RPDefine.DataID := IntToStr(HInstance);
end;
Multiple Application Instances, Update
There have been a number of reports of problems when using the code provided above. First, it is
critical that the DataID variable be set before any Rave connections have been created. Also, tests
indicate that, for reasons not clear at this time, using the main form HInstance variable does not
necessarily provide a value different for each instance of the application.
The currently recommended way of setting the DataID variable is to place the code in the project's
.DPR file and to use the application handle:
Delphi Example:
Delphi-Quellcode:
begin
RPDefine.DataID := IntToStr(Application.Handle);
Application.Initialize;
{etc...}
end;
You will need to add RPDefine and Sysutils to the DPR file's USES clause.
- TeamNevrona cannot respond to questions received via email -
http://rave-notes.blogspot.com
  Mit Zitat antworten Zitat