⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 readingthread_unit.pas

📁 ah 209型通用读卡器驱动程序源码
💻 PAS
字号:
unit ReadingThread_Unit;

interface

uses
  Classes,Windows,SyncObjs;

type
  ReadingThread = class(TThread)
  private
    { Private declarations }
  protected
    procedure Execute; override;
  end;
var
  Card_No : integer;
  Card_Type : byte;
  b:boolean =false;
  ReadThread :ReadingThread;
  OnlyOwner  :TCriticalSection; //临界区
implementation

uses ReadCard, Unit2;

{ 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 ReadingThread.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ ReadingThread }

procedure ReadingThread.Execute;
begin
   while not terminated do
   begin
      SendCardComm(0);
      Sleep(100);
      Send_Card_Comm(Card_No,Card_Type,b);
      if((Card_No <> 0 ) and(Card_Type <>$00)) then
        begin
           OnlyOwner.Acquire;
           mCardNo:=Card_No;
           mCardType:=Card_Type;
           OnlyOwner.Release;
           sleep(5);
        end;

   end;
end;

end.
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -