阁龙1427 发表于 2012-5-13 21:24:38

DLL求解释

本帖最后由 乐yi忘忧 于 2012-6-1 13:18 编辑

求解释这段代码:unit Common_Unit; usesSysUtils, Classes, DB, ADODB, Windows, Dialogs, Forms;typeTWriteIni = procedure(FileName,Section,Indet,Values: string); stdcall;//写Ini文件TReadIni = function(FileName,Section,Indet: string):string; stdcall;//读Ini文件function SQLDataSet(sqlText: string; ADOConn: TADOConnection): TDataSet; stdcall; external 'SQLOperator.dll'; //静态调用DLLprocedure SQLExecute(sqlText: string; ADOConn: TADOConnection); stdcall; external 'SQLOperator.dll'; // 执行SQL的函数function SQLSearch(sqlText: string; ADOConn: TADOConnection): Boolean; stdcall; external 'SQLOperator.dll'; //静态调用DLLfunction DBConFileName(FileName: string): string;function FileName: string;varDLLHandle: THandle;WriteIni: TWriteIni;ReadIni: TReadIni;LoginUser: string;   //登录时记录的登录编号,全局变量Flag: Integer;    //入学时间和毕业时间的标志 ,全局变量implementationfunction DBConFileName(FileName: string): string;begintry                   //动态加载DLL,DLL中包含了读取INI文件的函数    DLLHandle := LoadLibrary('CommInfo.dll');    @ReadIni :=GetProcAddress(DLLHandle,'ReadIni');    if @ReadIni <> nil then      Result := ReadIni(FileName,'BDConn','DBConFileName');finally    FreeLibrary(DLLHandle);//释放DLLend;end;function FileName: string;//搜索执行文件下的INI文件读取数据库的连接路径beginResult := ExtractFilePath(Application.ExeName) + 'ConfigDB.ini';end;end.

littleevil 发表于 2012-5-13 21:24:39

从CommInfo.dll获取ReadIni函数,并将函数首地址赋值给函数变量ReadIni

Gkimidr_源 发表于 2012-5-13 21:43:33

我表示看不懂,抢沙发的

1588/足球 发表于 2012-5-28 09:58:18

好像很复杂。。。。我不会

woawn 发表于 2012-6-11 18:21:31

{:2_28:}看不懂啊

qidaoshen 发表于 2014-3-16 01:55:04

看一看 看一看
页: [1]
查看完整版本: DLL求解释