向上帝打申请了,下辈子再也不做程序员!! 上帝批复:OK!

随笔分类 -  DLL函数

摘要:本例效果图: Dll 文件: library Lib; uses SysUtils, Classes; {$R *.res} procedure Test(p: PChar); const Title = 'Title '; var str: string; begin str := p; StrCopy(p, Title); StrCat(p, PChar(str)); end; expo... 阅读全文
posted @ 2009-03-17 14:53 zywuhao 阅读(275) 评论(0) 推荐(0)
摘要:本例将把一张 bmp 图片, 以资源文件的方式嵌入 dll, 然后再调用. 第一步: 建一个 DLL 工程, 如图:然后保存, 我这里使用的名称都是默认的. 第二步: 建一个资源原文件, 如图:编辑内容如下(路径中的文件一定要存在):img1 BITMAP "c:\temp\test.bmp"然后, 取个名(后缀须是 rc, 我这里取名为 Res.rc), 保存在工程目录下. 第三步:... 阅读全文
posted @ 2009-03-17 14:51 zywuhao 阅读(187) 评论(0) 推荐(0)
摘要://通过 DLL Wizard 建立:library TestDLL;uses SysUtils, Classes, Dialogs;{$R *.res}//建立过程procedure Test;begin ShowMessage('TestDLL.Test');end;//输出exports Test;beginend.//在其他工程调用,如果不在一个工程组,需要在相同目录下、Sys... 阅读全文
posted @ 2009-03-17 14:50 zywuhao 阅读(165) 评论(0) 推荐(0)
摘要:unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type //晚绑定,也就是动态调用外部函数主要用以下三个命令: //LoadLibrary:获取 DLL //GetProcAddress:获取函数... 阅读全文
posted @ 2009-03-17 14:48 zywuhao 阅读(190) 评论(0) 推荐(0)
摘要:unit Unit1;interfaceuses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls;type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sende... 阅读全文
posted @ 2009-03-15 18:52 zywuhao 阅读(215) 评论(0) 推荐(0)