Basta usar as DLLs de forma dinâmica.

Este é um exemplo de acessar dinâmicamente:

type TStrPcharFunction = function (P: string): Pchar; stdcall;

function CallFunction(DLL_File, DLL_Function, Param : String) : String;
var
  HInst: THandle;
  FPointer: TFarProc;
  MyFunct: TStrPcharFunction;
begin
  HInst := SafeLoadLibrary (DLL_File);
  if HInst > 0 then
  try
    FPointer := GetProcAddress (HInst, PChar(DLL_Function));
    if FPointer <> nil then
    begin
      MyFunct := TStrPcharFunction (FPointer);
      Result := MyFunct (Param);
    end
    else
      Result := '#Error - The function ' + DLL_Function + ' was not found.';
  finally
    FreeLibrary (HInst);
  end else Result := '#Error - ' + ExtractFilename(DLL_File) + ' library not
found.';
end;

Na DLL, cria-se funções neste padrão:

function NOMEFUNCAO (Paramentro : String) : Pchar; export; stdcall;

Modo de usar:

var
s : string
begin
s := CallFunction('c:\MinhaDLL.dll', 'NOMEFUNCAO', 'MinhaString');

Atenciosamente,
Felippe.



-- 
<<<<< FAVOR REMOVER ESTA PARTE AO RESPONDER ESTA MENSAGEM >>>>>

<*> Para ver as mensagens antigas, acesse:
    http://br.groups.yahoo.com/group/delphi-br/messages

<*> Para falar com o moderador, envie um e-mail para:
    [EMAIL PROTECTED]
 
Links do Yahoo! Grupos

<*> Para visitar o site do seu grupo na web, acesse:
    http://br.groups.yahoo.com/group/delphi-br/

<*> Para sair deste grupo, envie um e-mail para:
    [EMAIL PROTECTED]

<*> O uso que você faz do Yahoo! Grupos está sujeito aos:
    http://br.yahoo.com/info/utos.html

 


Responder a