Adding a VentaFax Plug-In A plug-in is a dynamic-link library (*.DLL) file which function is called after each reception and transmission session. To install a plug-in, put its file to the \PLUGINS subfolder. Next, in the settings window open the Miscellaneous - Plug-Ins tab. The plug-in file name should appear in the list of plug-ins. Check the corresponding box and click the Apply button. The AfterSession function is called from the plug-in in a separate thread. If several plug-ins are installed, several threads are running simultaneously, without waiting for the called function completion. The situation is possible when the AfterSession function is called several times in succession. Please keep this in mind when developing plug-ins. Plug-In Functions Description 1. A plug-in must contain at least the 'AfterSession' function as follows: // Delphi TAfterSession = function(R : TRec32C) : longint; stdcall; The following functions and procedures can also be present: 2. The 'PluginName' function. It returns the short plug-in name. const cNameLength = 16; type pTaPluginName = ^TaPluginName; TaPluginName = array[0..cNameLength-1] of Char; TPluginName = procedure(const pPluginName: pTaPluginName; const Size: DWord); stdcall; pPluginName - the pointer to a buffer for the function to fill up; Size - the size of the buffer. 3. The 'PluginDescription' function. It returns the description of the plug-in. const cDescriptionLength = 1024; type pTaPluginDescription = ^TaPluginDescription; TaPluginDescription = array[0..cDescriptionLength-1] of Char; TPluginDescription= procedure(const pPluginDescription: pTaPluginDescription; const Size: DWord); stdcall; pPluginDescription - the pointer to a buffer for the function to fill up; Size - the size of the buffer. 4. The 'Configure' procedure. It is called when a plug-in setting is necessary. TConfigure = procedure(hWnd: THandle); stdcall; hwnd - parent window handle. TRec32C Structure Description. ------------------------------ TDaTi = record Year : word; Month : word; Day : word; Hour : word; Min : word; Sec : word; end; PTRec32C = ^TRec32C; TRec32C = Record Phone : array[0..63] of char; Company : array[0..63] of char; ToAbonent : array[0..73] of char; FileName : array[0..255] of char; DocName : array[0..73] of char; Result, Speed, Quality : word; Date : TDaTi; Min, Sec : word; Pages : word; LastPage : word; NBlock : longint; NBadBlock: longint; Attr : word; ExtData : array[0..63] of char; CSI : array[0..21] of char; NCF : array[0..63] of char; RecId : longint; AbId : longint; CompName: array[0..31] of char; Reserve : array[0..63] of char; end; where Phone - the phone number the message was transmitted to (in case of transmission) or the phone number identified as the Caller ID (in case of reception); Company - the "To" field. Usually it is the recipient company name; ToAbonent - the "Attn." field. Usually it is the message recipient's name. FileName - the received or transmitted file name or the service announcement name; DocName - file description; Result - session completion code; Speed - in case of at facsimile reception/transmission shows the reception/transmission speed. In case of sound file recording/playback shows the sampling frequency; Quality - the facsimile resolution. 0 for normal, 1 for fine; Date - session date and time; Min, Sec - session duration; Pages - in case of reception - the number of pages received in case of facsimile transmission - the number of pages in the document to be transmitted in case of voice message recording/playback - the message duration in milliseconds (low-order word); LastPage - in case of facsimile transmission - the number of transmitted pages in case of voice message recording/playback - the message duration in milliseconds (high-order word); NBlock - the number of received/transmitted frames in ECM mode; NBadBlock - the number of re-received/retransmitted frames in ECM mode; Attr - session attributes.