Tema: Form en DLL
Ver Mensaje Individual
  #2  
Antiguo 10-08-2012
CSIE CSIE is offline
Miembro
 
Registrado: feb 2008
Ubicación: Universo paralelo
Posts: 69
Reputación: 19
CSIE Va por buen camino
Algo asi debería funcionarte (no lo he probado )

Código Delphi [-]
library CLDRes;

uses
  ShareMem, //Importante
  SysUtils,
  Classes,
  bsSkinData,
  Forms,
  Controls,
  uPassOk in 'FORM\uPassOk.pas' {wPassOk};

{$R *.res}


function DisplayModalForm(AHandle: THandle; S: String): Boolean; stdcall;
begin
     result := False;
     Application.Handle := AHandle;
     with TwPassOk.Create(Application) do
     try
       if ShowModal = mrOk then
         result := S = pePass.Text; 
     finally
       Free;
     end;
end;

  exports
    DisplayModalForm;
begin
end.

Código Delphi [-]
procedure TwMain.ClickStateChange(Sender: TObject);
const
  DLLNAME = 'CLDRes.dll';
var
  Passw: Boolean;
  DllHandle : THandle;
  DlgForm: procedure (H : THandle; S: string); stdcall;
begin
  with wDataModule do
    if dsUser.State = dsInsert then
      if (Sender as TbsSkinButton).Name = 'btAdmPost' then
      begin
        try
          DllHandle := LoadLibrary(DLLNAME);             
          if DllHandle <>0 then
          begin
             DlgForm := GetProcAddress(DllHandle,'DisplayModalForm');
             Passw := DlgForm(Application.Handle, dsUserPASS.AsString);
             ShowMessage(BoolToStr(Passw));
          end
          else
            ShowMessage(Format('Error al cargar %s',[DLLNAME]));          
        finally
          FreeLibrary(DllHandle);
        end;      
      end;
end;
Responder Con Cita