zoukankan
html css js c++ java
delphi 中DLL的建立
Dll的创建与调用
File ->New->Other->Dll Wizard
DLL的创建
//可以将本代码复制粘贴到项目中 library Project1; uses SysUtils, Classes, Windows, Forms; {$R *.res} function Min(x,y:Integer):Integer;stdcall; begin if (x<y) then Result:=x else Result:=y; end; procedure MsgBox(Msg:string;Title:string;uType:LongInt=MB_OK);stdcall; begin Application.MessageBox(PAnsiChar(Msg),PAnsiChar(Title),uType); end; exports Min, MsgBox; begin end.
DLL的调用1
//将Project1.dll文件复制到本项目中 unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; function Min(x,y:Integer):Integer;stdcall;external 'project1.dll'; procedure MsgBox(Msg:string;Title:string;uType:LongInt=MB_OK);stdcall;external 'project1.dll'; type TForm1 = class(TForm) Button1: TButton; Button2: TButton; procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); private { Private declarations } public { Public declarations } end; var Form1: TForm1; implementation {$R *.dfm} procedure TForm1.Button1Click(Sender: TObject); begin ShowMessage(IntToStr(Min(3,2))); end; procedure TForm1.Button2Click(Sender: TObject); begin MsgBox('Hello','Tips',MB_OK+MB_ICONINFORMATION); end; end.
来自为知笔记(Wiz)
附件列表
查看全文
相关阅读:
[ACM] hdu 1848 Fibonacci again and again(Nim博弈 SG函数)
[ACM] hdu 2176 取(m堆)石子游戏(Nim博弈)
[ACM] hdu 1850 Being a Good Boy in Spring Festival(Nim博弈)
母函数
Euclid算法(欧几里得算法)
Poj 2533
Poj 1836
Poj 3267
hdu 1878
poj 3349
原文地址:https://www.cnblogs.com/xe2011/p/3876090.html
最新文章
快速生成折线图及代码详解
如何利用百度音乐播放器的API接口来获取高音质歌曲
关于《算法设计》走迷宫问题之创建迷宫的优化
多维算法思考(三):AB组合问题
走迷宫问题
使用C# .NET 将结构数组绑定到 Windows 窗体的方法
C#如何打印RichTextBox控件的内容
怎样在不对控件类型进行硬编码的情况下在 C#vs 中动态添加控件
C#如何使用结构化异常处理
C#使用Lock访问共享数据的问题
热门文章
返回泛型集合的SqlDBHelper
SQL实现分页存储过程
SQL模糊查找
C语言定义一个指针变量
C语言指针
Greatest Number
[2010山东ACM省赛] Greatest Number(数的组合+二分搜索)
[ACM] hdu 1213 How Many Tables(并查集)
携程预赛第二场 1002 位图像素的颜色
[ACM] hdu 1536 S-Nim(Nim组合博弈 SG函数打表)
Copyright © 2011-2022 走看看