unit GlobalForm;
 
interface
 
uses
 Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
 StdCtrls;
 
type
 TGlobalFrm = class(TForm)
 GlobalProcessEdit: TEdit;
 GlobalThreadEdit: TEdit;
 LocalThreadEdit: TEdit;
 SharedDataEdit: TEdit;
 ReadBtn: TButton;
 IncBtn: TButton;
 DecBtn: TButton;
 SetBtn: TButton;
 CreateThread: TButton;
 procedure ReadBtnClick(Sender: TObject);
 procedure IncBtnClick(Sender: TObject);
 procedure DecBtnClick(Sender: TObject);
 procedure SetBtnClick(Sender: TObject);
 procedure CreateThreadClick(Sender: TObject);
 private
 { Private declarations }
 public
 { Public declarations }
 end;
 
var
 GlobalFrm: TGlobalFrm;
 
implementation
 
uses GlobalHdr, DelayThread;
 
procedure ReadInfo(var GlobalInfo: TGlobalInfo; var LocalThreads: integer);
 stdcall; external 'GlobalData.dll';
 
procedure SetSharedInteger(NewValue: integer);
 stdcall; external 'GlobalData.dll';
 
procedure IncSharedInteger;
 stdcall; external 'GlobalData.dll';
 
procedure DecSharedInteger;
 stdcall; external 'GlobalData.dll';
 
 
{$R *.DFM}
 
procedure TGlobalFrm.ReadBtnClick(Sender: TObject);
 
var
 GlobalInfo: TGlobalInfo;
 LocalThreads: integer;
 
begin
 ReadInfo(GlobalInfo, LocalThreads);
 GlobalProcessEdit.Text := IntToStr(GlobalInfo.GlobalProcesses);
 GlobalThreadEdit.Text := IntToStr(GlobalInfo.GlobalThreads);
 SharedDataEdit.Text := IntToStr(GlobalInfo.SharedNumber);
 
 LocalThreadEdit.Text := IntToStr(LocalThreads);
end;
 
procedure TGlobalFrm.IncBtnClick(Sender: TObject);
begin
 IncSharedInteger;
 ReadBtnClick(Sender);
end;
 
procedure TGlobalFrm.DecBtnClick(Sender: TObject);
begin
 DecSharedInteger;
 ReadBtnClick(Sender);
end;
 
procedure TGlobalFrm.SetBtnClick(Sender: TObject);
 
var
 NewInt: integer;
 
begin
 NewInt := StrToInt(SharedDataEdit.Text);
 SetSharedInteger(NewInt);
end;
 
procedure TGlobalFrm.CreateThreadClick(Sender: TObject);
 
var
 NewThread: TDelayThread;
 
begin
 NewThread := TDelayThread.Create(true);
 NewThread.FreeOnTerminate := true;
 NewThread.Resume;
end;
 
end.