threadparaio.pas

来自「dephi 7.0实现的TDMA工作原理.用于演示TDMA的工作流程」· PAS 代码 · 共 76 行

PAS
76
字号
unit ThreadparaIO;

interface

uses
  Windows,Messages,SysUtils,Variants,Classes,Graphics,Controls,Forms,
  Dialogs,StdCtrls, pubdata;

type
  TWriteParaIOThread = class(TThread)
  private
    { Private declarations }
    ObjFormHandle:HWND;
    Data:Pointer;
    PageIndex:Byte;
  protected
    procedure Execute; override;
    public
    constructor Create(CreateSuspend: Boolean; ObjHandle:HWND; PData:Pointer);
  end;
var
  TWrite:TWriteParaIOThread;
implementation
  uses  main;
{ 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 TWriteParaIOThread.UpdateCaption;
    begin
      Form1.Caption := 'Updated in a thread';
    end; }

{ TWriteParaIOThread }

procedure TWriteParaIOThread.Execute;
  { Place thread code here }
  var
 Temp1:^Byte;
 i:Integer;
 B:Byte;
 j:Integer;
begin
  { Place thread code here }
  temp1:=ptr(integer(data));
  Writing:=True;
for i:=0 to 8191 do
    begin
    if(i<=8191)then
       begin
       write37a($f4);
       write378(temp1^);
       write37a($f5);
       temp1:=ptr(Integer(temp1)+1);
       end;
    if(i=8191)then
       begin
       write37a($f4);
       write37a($f5);
       end;
    end;
  Writing:=False;
end;
constructor TwriteparaIOThread.Create(CreateSuspend: Boolean; ObjHandle:HWND; PData:Pointer);
 begin
  inherited create(False);
  Priority:=tpIdle;
  ObjFormHandle:=ObjHandle;
  Data:=PData;
  //FreeOnTerminate:=True;
end;
end.

⌨️ 快捷键说明

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