1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177
|
// L'Application appelante
unit UessaiIns;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls,UtilPhoenix;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Label2: TLabel;
Memo1: TMemo;
Memo2: TMemo;
procedure FormCreate(Sender: TObject);
procedure Button1Click(Sender: TObject);
procedure lanceInstructionSoft ;
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
var PSr:array[1..10] of real;
ResultInsCharLiteral:array[1..10]of string;
var HandleDLLInstruction: Thandle;
ExInstruction:function (NumInstruction:integer;
P1,P2,P3,P4,P5,P6,P7,P8,P9,P10:Pchar;
P11,P12,P13,P14,P15,P16,P17,P18,P19,P20:real;
MemoEtatRack:byte;
TareResitive:real;
PtmaxMultiplexeur:integer;
TableTrancoCourante:Pchar;
Var MemoEtatRack1:byte;
var R1,R2,R3,R4,R5,R6,R7,R8,R9,R10:Pchar;
var R11,R12,R13,R14,R15,R16,R17,R18,R19,R20:Real;
var Status:byte):integer; STDCALL;
procedure TForm1.FormCreate(Sender: TObject);
begin
HandleDLLInstruction:=LoadLibrary(PChar(CheminDLL+'DLLinstruction.dll'));
if HandleDLLInstruction<>0 then
begin
@ExInstruction:=GetProcAddress(HandleDLLInstruction,'ExInstruction');
end;
end;
procedure TForm1.Button1Click(Sender: TObject);
var i:integer ;
begin
lanceInstructionSoft;
end;
//****************************************************************************//
procedure TForm1.lanceInstructionSoft ;
var status:byte;
V:array[1..10] of string;
t:array[1..10] of Pchar;
r:array[1..10] of real;
i,j:integer;
EtatRack1:byte;
begin
for j:=0 to 4 do
begin
V[1]:=memo1.Lines[j];
ExInstruction (10, // numero Dll de l'instruction
Pchar(string(V[1])),
'','','','','','','','','',
0,0,0,0,0,0,0,0,0,0,
1,0,11,'',
EtatRack1,
t[1],t[2],t[3],t[4],t[5],t[6],t[7],t[8],t[9],t[10],
r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8],r[9],r[10],
Status);
for i:=1 to 10 do ResultInsCharLiteral[i]:=strPas(Pchar(T[i]));
memo2.Lines.add(ResultInsCharLiteral[1]);
Label1.caption:=inttostr(length(ResultInsCharLiteral[1]));
Label2.caption:=inttostr(length(memo2.Lines[J]));
end;
end;
end
//La DLL
unit DLLUinstruction;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
ComCtrls, ExtCtrls, StdCtrls, OleCtrls;
function ExInstruction(NumInstruction:integer;
P1,P2,P3,P4,P5,P6,P7,P8,P9,P10:Pchar;
P11,P12,P13,P14,P15,P16,P17,P18,P19,P20:real;
MemoEtatRack:byte;
TareResitive:real;
PtmaxMultiplexeur:integer;
TableTrancoCourante:Pchar;
Var MemoEtatRack1:byte;
var R1,R2,R3,R4,R5,R6,R7,R8,R9,R10:Pchar;
var R11,R12,R13,R14,R15,R16,R17,R18,R19,R20:Real;
var Status:byte):integer; STDCALL;
type
TFInstruction = class(TForm)
Private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
//------------------------------------------------------------------------------
var
FInstruction: TFInstruction;
implementation
exports ExInstruction name'ExInstruction';
{$R *.DFM}
//-----------------------------------------------------------------------------
function ExInstruction(NumInstruction:integer;
P1,P2,P3,P4,P5,P6,P7,P8,P9,P10 :Pchar;
P11,P12,P13,P14,P15,P16,P17,P18,P19,P20 :real;
MemoEtatRack :byte;
TareResitive :real;
PtmaxMultiplexeur :integer;
TableTrancoCourante :Pchar;
Var MemoEtatRack1:byte;
var R1,R2,R3,R4,R5,R6,R7,R8,R9,R10:Pchar;
var R11,R12,R13,R14,R15,R16,R17,R18,R19,R20:Real;
var Status:byte):integer; STDCALL;
var
ST,ST1,STconcat : string;
P :integer;
begin
R1:='' ;R2:='' ;R3:='' ;R4:='' ;R5:='' ;R6:='' ;R7:='' ;R8:='' ;R9:='' ;R10:='';
R11:=-1;R12:=-1;R13:=-1;R14:=-1;R15:=-1;R16:=-1;R17:=-1;R18:=-1;R19:=-1;R20:=-1;
// R1:=P1;
// exit;
STconcat:=strPas(P1);
R1:=Pchar(STconcat);
result:=0;
end;
//-----------------------------------------------------------------------------
end. |
Partager