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

📄 unit1.pas

📁 适用于接口课程设计
💻 PAS
字号:
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, TeEngine, Series, ExtCtrls, TeeProcs, Chart, StdCtrls, Buttons;

type
  ArrayOfInt = array[0..19] of Integer;

  //Tget = procedure(a:ArrayofInt);cdecl;
  Tget = procedure(a:ArrayofInt;var top:Integer)cdecl;
  TMain = procedure();cdecl;
  
  TForm1 = class(TForm)
    Chart1: TChart;
    Series1: TLineSeries;
    Timer2: TTimer;
    Timer1: TTimer;
    Label1: TLabel;
    Edit1: TEdit;
    Panel1: TPanel;
    Panel2: TPanel;
    procedure Timer1Timer(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure FormClose(Sender: TObject; var Action: TCloseAction);
    procedure Timer2Timer(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  Moudle:THandle;
  MyFun:TFarProc;
  MyMain:TFarProc;
  flag:Integer;
  count:Integer;
  
implementation

{$R *.dfm}

procedure TForm1.Timer1Timer(Sender: TObject);
var
  i: Integer;
  top1:Integer;
  top2:Integer;
  a: ArrayOfInt;
//  s: string;
begin
  //Moudle:=LoadLibrary('..\dll\get.dll');
  //if Moudle>32 then
  //begin
    //try
      //MyFun:=GetProcAddress(Moudle,'get');
      top2 := 20;
      Tget(MyFun)(a,top1);
      if (top1<20) then
        top2 := top1;
      With Series1 do
      begin
        Clear;
        for i:=0 to (top2-1) do
        begin
          Add(a[i]);
        end;
      end;
      Edit1.Text:=IntToStr(a[0]);
      if a[0]>=180 then
      begin
        Timer1.Interval:=2*1000;
        //count:=0;
        Timer2.Enabled:=True;
      end
      else
      begin
        Timer2.Enabled:=False;
        Timer1.Interval:=1000;
        Edit1.Font.Color:=clBlack;
        flag:=1;
      end;
      //Label1.Caption := s;
      //Memo1.Lines.Add(IntToStr(top2));
      //TMain(MyMain);
    //finally
      //FreeLibrary(Moudle);
    //end;
  //end;
end;

procedure TForm1.FormCreate(Sender: TObject);
begin
  Moudle:=LoadLibrary('..\dll\get.dll');
  if not(Moudle>32) then
    ShowMessage('Load dll Error!');
  MyFun:=GetProcAddress(Moudle,'get');
  MyMain:=GetProcAddress(Moudle,'main');
  Edit1.Font.Color := clBlack;
  flag:=1;
  count:=0;
end;

procedure TForm1.FormClose(Sender: TObject; var Action: TCloseAction);
begin
  FreeLibrary(Moudle);
end;

procedure TForm1.Timer2Timer(Sender: TObject);
begin
  //count:=count+1;
  //if count>3 then
    //Timer2.Enabled:=False;
  if flag=1 then
  begin
    Edit1.Font.Color := clRed;
    flag:=0;
  end
  else
  begin
    Edit1.Font.Color := clBlack;
    flag:=1;
  end;
  
end;

end.

⌨️ 快捷键说明

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