Ver Mensaje Individual
  #4  
Antiguo 07-01-2021
Punzo Punzo is offline
Miembro
 
Registrado: abr 2006
Posts: 96
Reputación: 19
Punzo Va por buen camino
Este es el código de mi .dll
Código Delphi [-]
library ConfiguraciónPDVDLL;

{ Important note about DLL memory management: ShareMem must be the
  first unit in your library's USES clause AND your project's (select
  Project-View Source) USES clause if your DLL exports any procedures or
  functions that pass strings as parameters or function results. This
  applies to all strings passed to and from your DLL--even those that
  are nested in records and classes. ShareMem is the interface unit to
  the BORLNDMM.DLL shared memory manager, which must be deployed along
  with your DLL. To avoid using BORLNDMM.DLL, pass string information
  using PChar or ShortString parameters. }

uses
  System.SysUtils,
  System.Classes,
  VCL.Forms,
  Windows,
  IdTCPClient,
  Dialogs,
  UConfiguracion in 'UConfiguracion.pas' {fmConfiguracion},
  UdmConexion in 'UdmConexion.pas' {dmConexion: TDataModule},
  UFamilia in '..\..\UnitsCompartidas\UFamilia.pas',
  JsonDataObjects in '..\..\UnitsCompartidas\JsonDataObjects.pas',
  uErrorDescrip in '..\..\UnitsCompartidas\uErrorDescrip.pas';

var
  DLLApp :TApplication;

{$R *.res}

procedure Crear(ParentApp :TApplication; var ClienCon :TIdTCPClient; IDClien :String); stdcall;
begin
  Application := ParentApp;
  //ShowMessage({'IDCliente param DLL: ' + IDCliente +} ' Port: ' + IntToStr(ClienCon.Port));
  fmConfiguracion := TfmConfiguracion.Create(nil);
  fmConfiguracion.Show;
  fmConfiguracion.ClienConLocal := ClienCon;
  IDCliente := IDClien;
  if Not(fmConfiguracion.ClienConLocal.Connected) then
    fmConfiguracion.ClienConLocal.Connect;
end;

procedure DLLUnload(Reason: Integer); register;
begin
  if Reason = DLL_PROCESS_DETACH then
    Application := DLLApp;
end;

exports
  Crear;

begin
  isMultiThread := True;
  DLLApp := Application;
  DLLProc := @DLLUnload;
end.
Responder Con Cita