正在阅读:用Delphi制作DLL的方法用Delphi制作DLL的方法

2004-10-18 10:11 出处:CSDN 作者:FlyHope2005 责任编辑:linjixiong

  九 .示例:

  DLL源代码:


  library Project2;

  uses
  SysUtils,
  Classes,
  Dialogs,
  Forms,
  Unit2 in 'Unit2.pas' {Form2};

  {$R *.RES}
  var
  ccc: Pchar;

  procedure OpenForm(mainForm:TForm);stdcall;
  var
  Form1: TForm1;
  ptr:PLongInt;
  begin
  ptr:=@(Application.MainForm);
  ptr^:=LongInt(mainForm);
  Form1:=TForm1.Create(mainForm);
  end;

  procedure InputCCC(Text: Pchar);stdcall;
  begin
  ccc := Text;
  end;

  procedure ShowCCC;stdcall;
  begin
  ShowMessage(String(ccc));
  end;

  exports
  OpenForm;
  InputCCC,
  ShowCCC;
  begin
  end.

  调用方源代码:


  unit Unit1;

  interface

  uses
  Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
  StdCtrls;


察看评论详细内容 我要发表评论
作者笔名 简短内容 发表时间
:
键盘也能翻页,试试“← →”键

相关文章

关注我们

最新资讯离线随时看 聊天吐槽赢奖品