|
||
The CAS ActiveX interface provides methods that create and manage CAS taglists, exchange taglists with NET SatisFAXtion servers, and provide debugging assistance during application development. CAS ActiveX controls (available from the Downloads section of this website) must be installed on a computer before using the ActiveX interface. When you are ready to send your first fax, make sure that you have examined the CAS Samples on this website. The CAS Samples provide live demonstrations and example source code for the most commonly used CAS functions. See the CAS Tags page for a listing of available CAS function and data tags. |
Accessing the CAS ActiveX Interface
The first thing an application needs to do is create a reference (or pointer) to the CAS ActiveX interface, and then save that reference so that it can be used globally throughout the application. All CAS ActiveX methods are available to an application once the reference to the interface has been created. Although a single, global CAS reference should suffice, there is no harm in creating multiple references to the ActiveX interface within the same application. The following examples demonstrate accessing the CAS ActiveX interface from VBScript, JavaScript, C++, and C# (.NET). Although each language has a unique method of accessing the ActiveX interface, all languages use the interface similarly. |
|
|||
Function AccessCAS() Dim CAS, Instance, Tl Set CAS = CreateObject("CASX.CAS") Instance = CAS.Open(0,"",0) If Instance <> 0 Then ' Create a taglist and delete it Tl = CAS.New() Call CAS.AddTag(Tl,"SUBJECT","Just an example") Call CAS.Delete(Tl) Call CAS.Close(Instance) End If End Function |
|||
function AccessCAS() { var CAS, Instance, Tl; if (CAS = new ActiveXObject("CASX.CAS")) { if (Instance = CAS.Open(0,"",0)) { // Create a taglist and delete it Tl = CAS.New(); CAS.AddTag(Tl,"SUBJECT","Just an example"); CAS.Delete(Tl); CAS.Close(Instance); } delete CAS; } } |
|||
#include <windows.h> #import <casx.dll> using namespace CASXLib; void AccessCAS() { ICAS *CAS; CLSID class_id; CoInitialize(NULL); if (CLSIDFromProgID(L"CASX.CAS",&class_id) == S_OK) { if (CoCreateInstance(class_id, NULL, CLSCTX_INPROC_SERVER, IID_IUnknown, (void **)&CAS) == S_OK) { int CAS_instance; if (CAS_instance = CAS->Open(0,"",0)) { // Create a taglist and delete it int Tl = CAS->New(); CAS->AddTag(Tl,"SUBJECT","Just an example"); CAS->Delete(Tl); CAS->Close(CAS_instance); } CAS->Release(); } } CoUninitialize(); } |
|||
// Add a COM Reference to your project to the "CASX 1.0 Type Library" public void AccessCAS() { CASXLib.CAS CAS = new CASXLib.CAS(); int instance; if ((instance = CAS.Open(0,"",0)) > 0) { // Create a taglist and delete it int Tl = CAS.New(); CAS.AddTag(Tl,"SUBJECT","Just an example"); CAS.Delete(Tl); CAS.Close(instance); } } |
Working with Taglists
Tl = CAS.New(); Sections are created by calling the CreateSection method. Tags are added to section taglists with the same AddTag method. The section is closed by calling the CloseSection method. Once a section is closed, no more tags can be added to it, but more tags and sections can be added to the root of the taglist.
Sl = CAS.CreateSection(Tl,"RECEIVER_ADDRESS","555-123-4567"); To work with response taglists from the fax server, the GetTag method is used to search for tags in taglists and to retrieve tag data.
stat = CAS.GetTag(Tl,"STATUS_NUM",0); Tags within sections are accessed by first opening the section with the OpenSection method. Once a section taglist is no longer needed, it is closed using the CloseSection method.
Sl = CAS.OpenSection(Tl,"MESSAGE_HANDLE[0]"); CAS Communications
if (CAS_Instance
= CAS.Open(0,"",0)) The Send method sends a function taglist to the CAS driver, to be processed by the CAS driver locally, or to be processed remotely by a NET SatisFAXtion server. The state of the CAS instance determines whether the taglist is processed locally or remotely. The taglist passed to the Send method is deleted as part of being processed by the CAS driver. The return value from the Send method is a new taglist containing the response from the function. When the application is finished with the response taglist, it must be passed to the Delete method. Response_Tl = CAS.Send(CAS_Instance,Send_Tl); The CAS function tags LOGON, OPEN_SESSION, CLOSE_SESSION and LOGOFF are used for session management, and are always processed by the local CAS driver. All other function tags are ignored by the local CAS driver, but are significant when they reach a NET SatisFAXtion server. CAS ActiveX clients initiate connections with NET SatisFAXtion servers in a two-step process:
After a successful LOGON and OPEN_SESSION, the client sends a function taglist to the server, and the server replies. If the client has more taglists to send, either immediately or in a short time, it can send repeatedly on the same session. When the client has no more to send to the server, it closes the session with the CLOSE_SESSION function. If the session is inadvertently left open, it will eventually time out. If the client is completely done sending to the server, it logs off to release all network resources, with the LOGOFF function.
Tl = CAS.New(); The following diagrams illustrate the different types of connections that CAS ActiveX clients can make, based on the protocol being used.
|
Select a link below for a detailed description of a CAS ActiveX method. |
||
Returns | Method | Parameters |
Initialization | ||
LONG | Open | Mode, DebugFile, MinBufSize |
VOID | Close | Instance |
Communication | ||
LONG | Send | Instance, TagList |
Primary Taglist Handling | ||
LONG | New | None |
LONG | AddTag | TagList, TagName, TagData |
VOID | Delete | TagList |
BSTR | GetTag | TagList, TagName, TagIndex |
LONG | GetTagCount | TagList, TagName |
LONG | CreateSection | TagList, TagName, TagData |
LONG | OpenSection | TagList, TagPath |
VOID | CloseSection | TagList |
LONG | GetSectionCount | TagList, TagName |
Advanced Taglist Handling (Most applications do not require these Advanced methods.) | ||
LONG | GetTagId | TagName |
LONG | GetTagType | TagName |
BSTR | GetTagName | TagId |
LONG | GetTagHandle | TagList, TagName, TagIndex |
BSTR | GetTagData | TagHandle |
LONG | GetTagDataLength | TagHandle |
LONG | GetTagDataType | TagHandle |
LONG | GetIdFromHandle | TagHandle |
VOID | RetTagHandle | TagHandle |
VOID | DeleteTag | TagHandle |
Utility | ||
LONG | DupTagList | TagList |
VOID | DumpString | Str |
BSTR | DumpTagList | TagList, Header |
BSTR | GetDbgDump | None |
BSTR | EncryptOnce | Password |
VOID | Sleep | Milliseconds |
CAS ActiveX Controls
When CAS ActiveX is installed, a small ensemble of files are included that provide CAS taglist and utility functions, as well as CAS networking services. The CAS ActiveX controls are copied to the directory "\Program Files\Common Files\FaxBack Shared\CASx". These shared files remain in this directory until all applications that use CAS are uninstalled. The core CAS ActiveX modules are as follows:
CAS ActiveX controls can be installed from the Downloads section of this website. |