⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unit3.~pas

📁 所有delphi的入门例子
💻 ~PAS
字号:
unit Unit3;

interface

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

type
  TForm3 = class(TForm)
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

  TMultiplyNum= procedure;

var
  Form3: TForm3;
  MultiplyNum:TMultiplyNum;  // 定义过程变量
  thehandle:Thandle;

implementation
  //procedure MultiplyNum;stdcall;external 'dllProject2.dll';
  function jia(X,Y:Integer):Integer;stdcall;external 'dllProject2.dll';

{$R *.dfm}

procedure TForm3.Button1Click(Sender: TObject);
begin

  thehandle:=loadlibrary('C:\Documents and Settings\Administrator\桌面\test\dllProject2.dll');
  if theHandle <> 0 then
   begin
    @MultiplyNum := GetProcAddress(theHandle,'MultiplyNum');
    if (@MultiplyNum) <> nil then
       begin
         TMultiplyNum(MultiplyNum);
         freelibrary(thehandle);
    end;
  //showmessage(inttostr(jia(3,4)));
  //MultiplyNum;
 end;
end;

end.
 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -