📄 eventthread.pas
字号:
unit EventThread;
interface
uses
Classes,Windows;
type
TEventThread = class(TThread)
private
{ Private declarations }
protected
procedure Execute; override;
end;
implementation
uses Driver, DiintForm, EVENT, Math;
{ Important: Methods and properties of objects in VCL or CLX can only be used
in a method called using Synchronize, for example,
Synchronize(UpdateCaption);
and UpdateCaption could look like,
procedure TEventThread.UpdateCaption;
begin
Form1.Caption := 'Updated in a thread';
end; }
{ TEventThread }
procedure TEventThread.Execute;
var
ptCheckEvent: PT_CheckEvent;
usEventType: Smallint;
dwErrCde: Integer;
begin
{ Place thread code here }
ptCheckEvent.EventType := @usEventType;
ptCheckEvent.Milliseconds := INFINITE;
while(not Terminated) do
begin
dwErrCde := DRV_CheckEvent(Form1.m_lDriverHandle, ptCheckEvent);
if (Form1.DoesErr(dwErrCde)=1)then
Exit;
usEventType := usEventType - ADS_EVT_INTERRUPT_DI0;
if((usEventType >=0) and (usEventType < Form1.m_usMaxChanNum)) then
Inc(Form1.m_dwEventCount[usEventType],1);
end;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -