60 |
|
{ } |
61 |
|
{************************************************************************} |
62 |
|
unit FB25Events; |
63 |
+ |
{$IFDEF MSWINDOWS} |
64 |
+ |
{$DEFINE WINDOWS} |
65 |
+ |
{$ENDIF} |
66 |
|
|
67 |
|
{$IFDEF FPC} |
68 |
< |
{$mode objfpc}{$H+} |
68 |
> |
{$mode delphi} |
69 |
|
{$interfaces COM} |
70 |
|
{$ENDIF} |
71 |
|
|
93 |
|
public |
94 |
|
constructor Create(aOwner: TFB25Events); |
95 |
|
destructor Destroy; override; |
96 |
< |
procedure eventCallbackFunction(length: short; updated: PChar); |
96 |
> |
procedure eventCallbackFunction(length: short; updated: PAnsiChar); |
97 |
|
procedure WaitForEvent; |
98 |
|
procedure CancelWait; |
99 |
|
end; |
153 |
|
constructor TEventHandlerThread.Create(Owner: TFB25Events; |
154 |
|
EventHandler: TEventhandlerInterface); |
155 |
|
begin |
156 |
< |
inherited Create(true); |
156 |
> |
inherited Create(false); |
157 |
|
FOwner := Owner; |
158 |
|
FEventHandler := EventHandler; |
159 |
|
FreeOnTerminate := true; |
157 |
– |
Start; |
160 |
|
end; |
161 |
|
|
162 |
|
procedure TEventHandlerThread.Terminate; |
167 |
|
|
168 |
|
{This procedure is used for the event call back - note the cdecl } |
169 |
|
|
170 |
< |
procedure IBEventCallback( ptr: pointer; length: short; updated: PChar); cdecl; |
170 |
> |
procedure IBEventCallback( ptr: pointer; length: short; updated: PAnsiChar); cdecl; |
171 |
|
begin |
172 |
|
if (ptr = nil) or (length = 0) or (updated = nil) then |
173 |
|
Exit; |
216 |
|
end; |
217 |
|
|
218 |
|
procedure TEventhandlerInterface.eventCallbackFunction(length: short; |
219 |
< |
updated: PChar); |
219 |
> |
updated: PAnsiChar); |
220 |
|
begin |
221 |
|
FOwner.FCriticalSection.Enter; |
222 |
|
try |