一个加密函数的例子
function TDMActMgr.PwdEncrypt(const Pwd: shortString): string;
var
DLLAPLHandle:THandle;
LoginEncrypt:TEncrypt;
DLLNamechar;
begin
DLLName:=PChar('C:/Project/DLLAPL.dll');
Result:='';
DLLAPLHandle:=LoadLibrary(DllName);
try
if DLLAPLHandle=0 then
raise EDLLLoadError.Create('DLLAPL.DLL载入错误');
@LoginEncrypt:=GetProcAddress(DLLAPLHandle,'Encrypt');
if @LoginEncrypt=nil then
Raise EDLLLoadError.Create('调用了DLLAPL.DLL中不存在的函数')
else
Result:=LoginEncrypt(Pwd,20078);
finally
FreeLibrary(DLLAPLHandle);
end;
end;