有如下xxxx.pas部分:Unit xxxx;interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;type
TMapiErrEvent = procedure(Sender: TObject; ErrCode: Integer) of object; TMapiControl = class(TComponent)
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
private
{ Private-Deklarationen }
FSubject: string;
FMailtext: string;
FFromName: string;
FFromAdress: string;
FTOAdr: TStrings;
FCCAdr: TStrings;
FBCCAdr: TStrings;
FAttachedFileName: TStrings;
FDisplayFileName: TStrings;
FShowDialog: Boolean;
FUseAppHandle: Boolean;
{ Error Events: }
FOnUserAbort: TNotifyEvent;
FOnMapiError: TMapiErrEvent;
FOnSuccess: TNotifyEvent; procedure SetToAddr(newValue: TStrings);
procedure SetCCAddr(newValue: TStrings);
procedure SetBCCAddr(newValue: TStrings);
procedure SetAttachedFileName(newValue: TStrings);
protected
{ Protected-Deklarationen }
public
{ Public-Deklarationen }
ApplicationHandle: THandle;
procedure Sendmail();
procedure Reset();
published
{ Published-Deklarationen }
property Subject: string read FSubject write FSubject;
property Body: string read FMailText write FMailText;
property FromName: string read FFromName write FFromName;
property FromAdress: string read FFromAdress write FFromAdress;
property Recipients: TStrings read FTOAdr write SetTOAddr;
property CopyTo: TStrings read FCCAdr write SetCCAddr;
property BlindCopyTo: TStrings read FBCCAdr write SetBCCAddr;
property AttachedFiles: TStrings read FAttachedFileName write SetAttachedFileName;
property DisplayFileName: TStrings read FDisplayFileName;
property ShowDialog: Boolean read FShowDialog write FShowDialog;
property UseAppHandle: Boolean read FUseAppHandle write FUseAppHandle; { Events: }
property OnUserAbort: TNotifyEvent read FOnUserAbort write FOnUserAbort;
property OnMapiError: TMapiErrEvent read FOnMapiError write FOnMapiError;
property OnSuccess: TNotifyEvent read FOnSuccess write FOnSuccess;
end;procedure Register;implementationuses Mapi;{ Register the component: }procedure Register;
begin
RegisterComponents('expectIT', [TMapiControl]);
end;{ TMapiControl }constructor TMapiControl.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FOnUserAbort := nil;
FOnMapiError := nil;
FOnSuccess := nil;
.........
怎样封装到DLL中,如何使用dll?????
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs;type
TMapiErrEvent = procedure(Sender: TObject; ErrCode: Integer) of object; TMapiControl = class(TComponent)
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
private
{ Private-Deklarationen }
FSubject: string;
FMailtext: string;
FFromName: string;
FFromAdress: string;
FTOAdr: TStrings;
FCCAdr: TStrings;
FBCCAdr: TStrings;
FAttachedFileName: TStrings;
FDisplayFileName: TStrings;
FShowDialog: Boolean;
FUseAppHandle: Boolean;
{ Error Events: }
FOnUserAbort: TNotifyEvent;
FOnMapiError: TMapiErrEvent;
FOnSuccess: TNotifyEvent; procedure SetToAddr(newValue: TStrings);
procedure SetCCAddr(newValue: TStrings);
procedure SetBCCAddr(newValue: TStrings);
procedure SetAttachedFileName(newValue: TStrings);
protected
{ Protected-Deklarationen }
public
{ Public-Deklarationen }
ApplicationHandle: THandle;
procedure Sendmail();
procedure Reset();
published
{ Published-Deklarationen }
property Subject: string read FSubject write FSubject;
property Body: string read FMailText write FMailText;
property FromName: string read FFromName write FFromName;
property FromAdress: string read FFromAdress write FFromAdress;
property Recipients: TStrings read FTOAdr write SetTOAddr;
property CopyTo: TStrings read FCCAdr write SetCCAddr;
property BlindCopyTo: TStrings read FBCCAdr write SetBCCAddr;
property AttachedFiles: TStrings read FAttachedFileName write SetAttachedFileName;
property DisplayFileName: TStrings read FDisplayFileName;
property ShowDialog: Boolean read FShowDialog write FShowDialog;
property UseAppHandle: Boolean read FUseAppHandle write FUseAppHandle; { Events: }
property OnUserAbort: TNotifyEvent read FOnUserAbort write FOnUserAbort;
property OnMapiError: TMapiErrEvent read FOnMapiError write FOnMapiError;
property OnSuccess: TNotifyEvent read FOnSuccess write FOnSuccess;
end;procedure Register;implementationuses Mapi;{ Register the component: }procedure Register;
begin
RegisterComponents('expectIT', [TMapiControl]);
end;{ TMapiControl }constructor TMapiControl.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
FOnUserAbort := nil;
FOnMapiError := nil;
FOnSuccess := nil;
.........
怎样封装到DLL中,如何使用dll?????
写为DLL,也很容易的么!