本帖最后由 乐yi忘忧 于 2012-6-1 13:18 编辑
求解释这段代码: unit Common_Unit; uses SysUtils, Classes, DB, ADODB, Windows, Dialogs, Forms; type TWriteIni = 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'; //静态调用DLL procedure SQLExecute(sqlText: string; ADOConn: TADOConnection); stdcall; external 'SQLOperator.dll'; // 执行SQL的函数 function SQLSearch(sqlText: string; ADOConn: TADOConnection): Boolean; stdcall; external 'SQLOperator.dll'; //静态调用DLL function DBConFileName(FileName: string): string; function FileName: string; var DLLHandle: THandle; WriteIni: TWriteIni; ReadIni: TReadIni; LoginUser: string; //登录时记录的登录编号,全局变量 Flag: Integer; //入学时间和毕业时间的标志 ,全局变量 implementation function DBConFileName(FileName: string): string; begin try //动态加载DLL,DLL中包含了读取INI文件的函数 DLLHandle := LoadLibrary('CommInfo.dll'); @ReadIni :=GetProcAddress(DLLHandle,'ReadIni'); if @ReadIni <> nil then Result := ReadIni(FileName,'BDConn','DBConFileName'); finally FreeLibrary(DLLHandle); //释放DLL end; end; function FileName: string;//搜索执行文件下的INI文件读取数据库的连接路径 begin Result := ExtractFilePath(Application.ExeName) + 'ConfigDB.ini'; end; end. |