delphi7调用DLL链接库总是出错,大神帮我看看
unit Unit1;interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, OleCtrls, ActProgTypeLib_TLB,WinSock;
type
TForm1 = class(TForm)
btn1: TButton;
btn2: TButton;
edt1: TEdit;
edt2: TEdit;
edt3: TEdit;
edt4: TEdit;
btn3: TButton;
actmlprgtyp1: TActMLProgType;
procedure btn1Click(Sender: TObject);
procedure btn2Click(Sender: TObject);
procedure btn3Click(Sender: TObject);
//int WSAStarup(WORD wVersionRequested,LPWSADATA lpWSAData);
private
{ Private declarations }
public
{ Public declarations }
end;
type
LKIF_OPENPARAM_ETHERNET= record
IPAddress: in_addr;
end;
{type
in_addr = record
S_addr: Integer;
end; }
var
Form1: TForm1;
implementation
var
m_points: array [0..4800] of Double ;
m_points_X: array [0..4800] of Double ;
m_points_Y: array [0..3600] of Double ;
{$R *.dfm}
function LKIF2_OpenDeviceETHER(OpenParam: LKIF_OPENPARAM_ETHERNET):Integer;cdecl;external'C:UsersAdministratorDesktop软件 - 副本LKIF2.dll';
procedure TForm1.btn1Click(Sender: TObject);
var
i:Integer;
X1,X2,X3,Y1,Y2,Y3,X1Y1,X1Y2,X2Y1: Double;
C,D,E,G,H,N: Double;
A,B,R: Double;
a1,b1,c1: Double;
Q:Double;
begin
X1:=0 ; Y1:=0; X2:=0; Y2:=0; X3:=0; Y3:=0; X1Y1:=0;
X1Y2:=0; X2Y1:=0;
for i:=0 to 4 do
begin
Q:= (360/4)* (i-0)*3.1415/180;
m_points_X[i]:= m_points[i]* Cos(Q);
m_points_Y[i]:= m_points[i]* Sin(Q);
X1:= X1 + m_points_X[i];
Y1:= Y1 + m_points_y[i];
X2:= X2 + m_points_X[i]* m_points_X[i];
Y2:= Y2 + m_points_Y[i]* m_points_y[i];
X3:= X3 + m_points_x[i]* m_points_x[i] * m_points_x[i];
Y3:= Y3 + m_points_y[i]* m_points_y[i] * m_points_y[i];
X1Y1:= X1Y1 + m_points_x[i]* m_points_y[i];
X1Y2:= X1Y2 + m_points_x[i]* m_points_y[i] * m_points_y[i];
X2Y1:= X2Y1 + m_points_x[i]* m_points_x[i] * m_points_y[i];
end;
N:= i-1;
C:= N* X2 - X1*X1;
D:= N* X1Y1 - X1* Y1;
E:= N*X3 + N* X1Y2- (X2+ Y2)* X1;
G:= N* Y2- Y1* Y1;
H:= N* X2Y1 + N* Y3 -(X2+ Y2)* Y1;
a1:= (H* D - E * G)/ (C * G - D * D);
b1:= (H* C - E * D)/ (D * D - G * C);
c1:= -(a1* X1 + b1* Y1+ X2+ Y2)/N;
A:=a1/(-2);
B:= b1/(-2);
R:= Sqrt(a1* a1+ b1*b1- 4* c1)/2;
end;
procedure TForm1.btn2Click(Sender: TObject);
var
L,H,M:Double;
KK:pchar;
begin
m_points[0]:= StrToFloat(edt1.Text);
m_points[1]:= StrToFloat(edt2.Text);
m_points[2]:= StrToFloat(edt3.text);
m_points[3]:= StrToFloat(edt4.Text);
//edt3.Text:=FloatToStr(StrToFloat(edt1.Text) * StrToFloat(edt2.Text));
end;
procedure TForm1.btn3Click(Sender: TObject);
var
OpenParam: LKIF_OPENPARAM_ETHERNET;
IPAddres:PAnsiChar;
begin
IPAddres:= '192.168.10.10';
OpenParam.IPAddress.S_addr:=inet_addr(IPAddres);
LKIF2_OpenDeviceETHER(OpenParam);
end;
end.