1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
|
program server;
{$APPTYPE CONSOLE}
uses
mdMailslot,messages,sysutils,windows,classes;
type
TConnection = class
procedure terminalMessageAvail(Sender: TObject; Msg: string);
end;
var
Terminal: TmdsecureMail;
connection:Tconnection;
active:boolean;
aMsg: TMsg;
const slot = 'demo';
procedure Tconnection.terminalMessageAvail(Sender: TObject; Msg: string);
begin
write('Message: ');
writeln(msg);
end;
begin
//connection:=Tconnection.Create;
Terminal:= TmdsecureMail.Create(nil);
terminal.Server:='.';
terminal.MaxSize:=0;
terminal.Slot:='demo';
terminal.OnMessageAvail:= connection.terminalMessageAvail;
terminal.Active:=true;
Active := True;
while Active do
begin
Sleep(100);
if PeekMessage(aMsg, 0, 0, 0, PM_REMOVE) then
begin
if aMsg.Message <> $0012 then
begin
TranslateMessage(aMsg);
DispatchMessage(aMsg);
end
else
begin
Break;
end;
end;
end;
end. |
Partager