eventthread.pas
来自「usb4711A数据采集卡的DI转换通道程序」· PAS 代码 · 共 55 行
PAS
55 行
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 + =
减小字号Ctrl + -
显示快捷键?