DELPHI盒子
!实时搜索: 盒子论坛 | 注册用户 | 修改信息 | 退出
检举帖 | 全文检索 | 关闭广告 | 捐赠
技术论坛
 用户名
 密  码
自动登陆(30天有效)
忘了密码
≡技术区≡
DELPHI技术
lazarus/fpc/Free Pascal
移动应用开发
Web应用开发
数据库专区
报表专区
网络通讯
开源项目
论坛精华贴
≡发布区≡
发布代码
发布控件
文档资料
经典工具
≡事务区≡
网站意见
盒子之家
招聘应聘
信息交换
论坛信息
最新加入: liy187
今日帖子: 0
在线用户: 1
导航: 论坛 -> DELPHI技术 斑竹:liumazi,sephil  
作者:
男 shiwenwu999 (史文武) ▲▲▲▲△ -
普通会员
2021/1/27 11:09:23
标题:
delphi7 调用链接库总是出错,帮忙看看怎么回事 浏览:685
加入我的收藏
楼主: 调用就显示错误,VB里调用就没事

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:\Users\Administrator\Desktop\软件 - 副本\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);
   //  edt4.Text:= IntToStr(OpenParam.IPAddress.S_addr)
    //edt4.Text:= IntToStr(LKIF2_OpenDeviceETHER(OpenParam));
    LKIF2_OpenDeviceETHER(OpenParam);
end;

end.
此帖子包含附件:
PNG 图像
大小:53.0K
----------------------------------------------
-
作者:
男 keymark (嬲) ▲▲▲△△ -
普通会员
2021/1/28 13:26:49
1楼: 去看Windows 单元的 (一堆微软api) dll声明标准
----------------------------------------------
[alias]  co = clone --recurse-submodules  up = submodule update --init --recursiveupd = pullinfo = statusrest = reset --hard懒鬼提速https://www.cctry.com/>http://qalculate.github.io/downloads.htmlhttps://www.cctry.com/
信息
登陆以后才能回复
Copyright © 2CCC.Com 盒子论坛 v3.0.1 版权所有 页面执行61.52344毫秒 RSS