The Elements of the ActiveX Interface
The Caché ActiveX binding provides access to Caché from any application that supports ActiveX objects. This binding allows you to instantiate and manipulate Caché objects within client applications, and provides a transparent interface to their server-side object instantiations. Examples in this book are written in Visual Basic, but the Caché ActiveX binding can be used just as easily in many other development environments.
The Caché Object Server for ActiveX
The Caché Object Server for ActiveX (CacheActiveX.dll) is a complete ActiveX in-process automation server that gives client applications access to server-based Caché objects. Internally, the Caché Object Server for ActiveX creates an ActiveX proxy object that mirrors an object on a Caché server. Object properties are exposed as ActiveX properties. Similarly, methods are exposed as ActiveX methods. When a method of an ActiveX proxy object is called, it causes the corresponding method to be called by the mirrored Caché object on the server machine.
Every client-side ObjInstance proxy object refers to a Caché object on a server. It is possible for several client-side objects to refer to the same server-side object. With each added reference, the server-side object's reference count is increased by one as long as any client-side objects are connected to it.
Client-side objects that perform special functions, such as the SysList and ResultSet objects, are not based on a Caché object and do not refer to an object on a server. See the Caché ActiveX API Reference for more information on the types of objects available from ActiveX.
The client-side proxy object is an ActiveX object and is referred to using a pointer to the IDispatch interface. For example, to access the properties and methods of a patient object from Visual Basic, use the following code:
Print patient.Name 'returns the value of Name for the referenced patient object Print patient.Admit 'runs the Admit() method of the patient object on the server
As an improvement on typical ActiveX automation servers, the Caché Object Server for ActiveX does not require you to register every object class that you define with the client operating system. Instead, it determines class information at run time. This lets you develop large applications with many client machines and many server-based objects without having to maintain ActiveX registry entries.
Upgrading from CacheObject.dll
Although CacheActiveX.dll has been the preferred version of the Caché ActiveX binding since Caché 5.1, the binding is also available through an older DLL, CacheObject.dll. This DLL is slower and has some small differences, as noted in this documentation. You should use CacheActiveX.dll for all new development. The older DLL is provided only for backward compatibility. The two DLLs differ primarily in the following ways:
CacheActiveX.dll can be used on 64-bit Windows in a 64-bit process.
Internally, CacheActiveX.dll uses the Caché C++ binding to get object-level access to a Caché server, providing better performance in some cases due to more sophisticated object caching.
CacheActiveX.dll supports Caché security (including features such as the ability to use Kerberos authentication), and does not support the less secure encrypted password feature used by CacheObject.dll.
The default SQL runtime display mode for CacheActiveX.dll is ODBC, rather than Logical as inCacheObject.dll.
When using CacheActiveX.dll proxy objects (see The Objinstance Class), the sys_Close() method actually closes the server object. The method does nothing when called by CacheObject.dll proxy objects.
To preserve complete compatibility with existing applications, Caché installs both CacheActiveX.dll and CacheObject.dll. By default, existing applications will continue to use the original CacheObject.dll. If you wish to use the newer binding, you must modify your existing application to reference this new DLL, and test that your application performs as expected. To upgrade your code from CacheObject.dll to CacheActiveX.dll, perform the following steps:
Replace all references to CacheObject.Factory with CacheActiveX.Factory.
Make any changes required by the switch from Logical to ODBC SQL runtime display mode (see the ResultSet.SetRunTimeMode() method).
Optionally, modify connection logic to use the new Caché security features, as described in Connecting to a Server.