home *** CD-ROM | disk | FTP | other *** search
- unit Simplevb;
-
- interface
-
- uses
- SysUtils, WinTypes, WinProcs, Messages, Classes, Graphics, Controls,
- Forms, Dialogs, StdCtrls, ExtCtrls, MXMAILX;
-
- {$I mailxdef.int}
-
- type
- TSimpleForm = class(TForm)
- btlLogon: TButton;
- GroupBox1: TGroupBox;
- Label2: TLabel;
- szMsgNum: TLabel;
- Bevel1: TBevel;
- Label1: TLabel;
- szCount: TLabel;
- Label3: TLabel;
- Label4: TLabel;
- szSubject: TEdit;
- szNoteText: TMemo;
- btnFirst: TButton;
- btnNext: TButton;
- MXForm1: TMXForm;
- MXSession1: TMXSession;
- MXMessage1: TMXMessage;
- procedure btlLogonClick(Sender: TObject);
- procedure btnFirstClick(Sender: TObject);
- procedure btnNextClick(Sender: TObject);
- procedure FormCreate(Sender: TObject);
- procedure FormUpdate;
- function IsSessionActive:Boolean;
- private
- { Private declarations }
- public
- { Public declarations }
- end;
-
- var
- SimpleForm: TSimpleForm;
-
- implementation
-
- {$R *.DFM}
- uses MailSys;
-
- procedure TSimpleForm.btlLogonClick(Sender: TObject);
- begin
- MXSession1.Logon:=TRUE;
- if IsSessionActive=TRUE then
- begin
- szCount.caption:=IntToStr(MXMessage1.MsgCount);
- btnFirstClick(Sender);
- end
- else
- begin
- szCount.caption:='';
- szSubject.Text:='';
- szNoteText.Text:='';
- szMsgNum.caption:='';
- end;
- end;
-
- procedure TSimpleForm.btnFirstClick(Sender: TObject);
- begin
- if IsSessionActive=TRUE then
- begin
- MXMessage1.Action:=ACTION_FINDFIRST;
- FormUpdate;
- end;
-
- end;
-
- function TSimpleForm.IsSessionActive:Boolean;
- begin
- if MXSession1.Logon=TRUE then
- begin
- Result:=TRUE;
- end
- else
- begin
- Application.MessageBox('No Active Session available',
- 'Mail eXtension DEMO for DELPHI',
- MB_ICONSTOP);
- Result:=FALSE;
- end;
- end;
-
- procedure TSimpleForm.btnNextClick(Sender: TObject);
- begin
- if IsSessionActive=TRUE then
- begin
- MXMessage1.Action:=ACTION_FINDNEXT;
- FormUpdate;
- end;
-
- end;
-
- procedure TSimpleForm.FormUpdate;
- begin
- if (MXMessage1.ErrorNum<>0) then
- begin
- Application.MessageBox('Error Fetching Inbox message',
- 'Mail X DEMO for DELPHI',
- MB_ICONINFORMATION);
- end
- else
- begin
- szSubject.Text:=MXMessage1.Subject;
- szNoteText.Lines:=MXMessage1.NoteText;
- szMsgNum.caption:=IntToStr(MXMessage1.FetchMsg);
- end;
- end;
-
- procedure TSimpleForm.FormCreate(Sender: TObject);
- var
- MailSystem: TMailSystem;
- begin
- MailSystem:=TMailSystem.Create(Self);
- MailSystem.ShowModal;
- MailSystem.Free;
- end;
-
- end.
-