Open

CAS ActiveX Methods

The Open method allocates resources in the CAS driver that are necessary for network and inter-process communications, and returns an instance handle that must be passed to the Send method.  When the instance handle is no longer needed, it must be passed to the Close method.

To trace the interaction between your application and the CAS driver and servers, different debug modes can be passed to the Open method that will cause all communications to be logged, either to a file or in memory.  A memory debug log can be retrieved with the GetDbgDump method.

LONG Open(
  LONG Mode, // Enables memory based debug logging
  BSTR DebugFile, // File name for file based debug logging
  LONG MinBufSize // Size of memory debug log buffer
)


Parameters:
Mode
Value Description
0 Non-debug operation.  Use mode 0 for best performance.
2 Enables memory based debug logging for the Send method.  The debug buffer can be retrieved using the GetDbgDump method.
4 Enables HTML debug formatting, ideal for when the debug buffer will be displayed in an HTML element or document body.  Otherwise, debug is formatted as plain-text.
Debug modes can be combined, for example, Debug + HTML formatting = 6.

DebugFile Fully qualified name of a file that receives debug data.  Specifying a file name enables file based debug logging for the Send method.  For example, in JavaScript, the Open method would be called as follows:

if (instance = CAS.Open(0,"c:\\debug\\caslog.txt",0))
  {
    // Prepare and Send taglists...

  CAS.Close(instance);
  }

MinBufSize Size of internal debug buffer.  If the buffer is full when new debug data is added, the oldest debug data is overwritten.  To avoid this situation, call GetDbgDump often to retrieve and save or display the contents of the debug buffer. 

Return Values:
Instance handle or null if there was a fatal error.

Example:
function LogOn()
 {
 var CAS_instance;

   // Get access to CAS interface and open an instance

 if (CAS = new ActiveXObject("CASX.CAS"))
   {  
   if (CAS_instance = CAS.Open(0,"",0)) 
     {
     var Tl, UniqueName, StatusNum;

       // Logon to the connection router
        
     Tl = CAS.New();
     CAS.AddTag(Tl,"LOGON","");
     UniqueName = "XYZ-"+parseInt(Math.random()*1000000+1000000);
     CAS.AddTag(Tl,"LOGON_NAME",UniqueName);
     CAS.AddTag(Tl,"DOMAIN_NAME","\\\\CASDEV\\NETSATISFAXTION");
     CAS.AddTag(Tl,"PROTOCOL",2); // IP

     Tl = CAS.Send(CAS_instance,Tl);
     StatusNum = parseInt(CAS.GetTag(Tl,"STATUS_NUM",0));
     CAS.Delete(Tl);
      
     if (StatusNum == 0)
       {
       return(
CAS_instance);
       }
        
     CAS.Close(CAS_instance);
     }
   }

 return(null);
 }

See Also:
CAS Close, LOGON, CAS New