DLL 实现单元

来源:互联网 发布:ubuntu更新软件的方法 编辑:程序博客网 时间:2024/05/16 01:25
unit uSetConfig;interfaceuses  SysUtils, uInterface, Windows, Controls, Forms, FSetForm;type{ TDllTest }  TIConfig = class(TInterfacedObject, IConfig)  private    FNotic:INotic;  protected    procedure SetNotic(aNotic:INotic); stdcall;    function GetUserInfo(var sID,sPwd:WideString):Boolean;stdcall;    procedure ShowForm(App:THandle;Notice:INotic);stdcall;  public    constructor Create;    destructor Destroy; override;  end;  function CreateDll: IConfig; stdcall; //Dll导出函数exports  CreateDll;  implementationfunction CreateDll: IConfig; stdcall;begin  Result := TIConfig.Create;end;{ TIConfig }constructor TIConfig.Create;beginend;destructor TIConfig.Destroy;begin  FNotic := nil;  inherited;end;function TIConfig.GetUserInfo(var sID, sPwd: WideString): Boolean;begin  result := True;  try    TConfig.GetUserInfo(sID,sPwd);  except    result := False;  end;end;procedure TIConfig.SetNotic(aNotic: INotic);begin  FNotic := aNotic;end;procedure TIConfig.ShowForm(App: THandle; Notice: INotic);begin  Application.Handle:=app;  fmSetForm:=TfmSetForm.create(application);  fmSetForm.Notic := Notice;  fmSetForm.ShowModal;  fmSetForm.Free;end;end.

0 0
原创粉丝点击