Class TmdCustomMailSlot (unit mdMailSlot) |
Inherits from
TComponent
......................................................... TmdCustomMailSlot .........................................................
Constructor Create(AOwner : TComponent);
- Public declarations } // Default functions
.
Procedure Close;
Procedure Loaded;
Procedure Open;
Ver 1.
Procedure ReadMessage;
Function ReadNext : String;
Procedure SetName(const NewName: TComponentName);
Procedure DoClose;
Procedure DoMessageAvail(Const Msg : String);
Procedure DoOpen;
Protected declarations } // Event process functions Event process functions
Procedure PerformError(Const Err : String);
Special functions Special functions
Procedure UpdateSlotInfo;
Function GetNextSize : DWord;
I want that it is possible to check on waiting without testing Active first
Function GetWaiting : DWord;
Procedure SetActive(Value : Boolean);
Property modification functions Property modification functions
Procedure SetMaxSize(Value : DWord);
Ver 1.
Procedure SetServer(Const Value : String);
Not needed since open and close set FActive [DGN] FActive := Value; // Ver 1.
Procedure SetSlot(Const Value : String);
Ver 1.
property Active : Boolean
properties - Read/Write
property Handle : THandle
properties - Read Only
property MaxSize : DWord
property NextSize : DWord
property Server : String
property Slot : String
property Waiting : DWord
event OnClose : TNotifyEvent
event OnMessageAvail : TmsMessageAvail
event OnOpen : TNotifyEvent
Events
FActive : Boolean;
Ver 1.
FClose : TNotifyEvent;
FHandle : THandle;
FLoadedActiveValue : Boolean;
Private declarations } // Property storage variables
FMaxSize : DWord;
FMessageAvail : TmsMessageAvail;
FNextSize : DWord;
FOpen : TNotifyEvent;
Event storage variables
FServer : String;
FSlot : String;
FSlotChanged : Boolean;
Misc values
FWaiting : DWord;
FWaitThread : TmdMailSlotWaitThread;
Constructor Create(AOwner : TComponent);
Public declarations } // Default functions
......................................................... TmdWaitThread ......................................................... (*
Type
TmdWaitCall = Procedure of object;
TmdWaitThread = Class(TThread)
Protected
FPath : String;
FChanged : TmdWaitCall;
Public
Constructor Create(Const Path : String; Changed : TmdWaitCall);
Procedure Execute; Override;
end;
Constructor TmdWaitThread.Create(Const Path : String; Changed : TmdWaitCall);
Begin
Inherited Create(False);
FPath := Path;
FChanged := Changed;
FreeOnTerminate := True;
end;
Procedure TmdWaitThread.Execute;
Var
Handle : THandle;
Begin
Handle := FindFirstChangeNotification(PChar(FPath),False,
FILE_NOTIFY_CHANGE_SIZE OR
FILE_NOTIFY_CHANGE_LAST_WRITE );
If Handle <> INVALID_HANDLE_VALUE Then
Begin
If (WaitForSingleObject(Handle,Infinite) <> WAIT_FAILED) AND
Assigned(FChanged) Then
FChanged;
FindCloseChangeNotification(Handle);
end;
end;
*) ......................................................... TmdCustomMailSlot ......................................................... Default functions
Procedure Close;
Procedure Loaded;
Procedure Open;
Ver 1.4 Special functions
Procedure ReadMessage;
Function ReadNext : String;
Procedure SetName(const NewName: TComponentName);
Procedure DoClose;
Procedure DoMessageAvail(Const Msg : String);
Procedure DoOpen;
Protected declarations } // Event process functions
Event process functions
Procedure PerformError(Const Err : String);
Special functions
Special functions
Procedure UpdateSlotInfo;
Function GetNextSize : DWord;
I want that it is possible to check on waiting without testing Active first
Function GetWaiting : DWord;
Procedure SetActive(Value : Boolean);
Property modification functions
Property modification functions
Procedure SetMaxSize(Value : DWord);
Ver 1.6
Procedure SetServer(Const Value : String);
Not needed since open and close set FActive [DGN] FActive := Value; // Ver 1.6
Procedure SetSlot(Const Value : String);
Ver 1.6
property Active : Boolean
properties - Read/Write
property Handle : THandle
properties - Read Only
property MaxSize : DWord
property NextSize : DWord
property Server : String
property Slot : String
property Waiting : DWord
event OnClose : TNotifyEvent
event OnMessageAvail : TmsMessageAvail
event OnOpen : TNotifyEvent
Events
FActive : Boolean;
Ver 1.4
FClose : TNotifyEvent;
FHandle : THandle;
FLoadedActiveValue : Boolean;
Private declarations } // Property storage variables
FMaxSize : DWord;
FMessageAvail : TmsMessageAvail;
FNextSize : DWord;
FOpen : TNotifyEvent;
Event storage variables
FServer : String;
FSlot : String;
FSlotChanged : Boolean;
Misc values
FWaiting : DWord;
FWaitThread : TmdMailSlotWaitThread;