Next Previous Up Top Contents Index

4.6 Building an Automation server application

4.6.8 Retaining arguments sent to dispatch methods

When an Automation server receives a string or array as a method argument, it is temporarily allocated a value (an instance of <ole-array>, <BSTR>, or <ole-vector>) that is deleted after the method returns, so you will need to make a copy of the data if you want to keep it. You can use the function copy-automation-value to do this. (Copying is done automatically when setting a property.)

Similarly, if an argument is an interface (such as <class-factory> or <LPDISPATCH>) you must call AddRef on it if it will be kept for use after the call returns, and later call Release when finished with it.


OLE, COM, ActiveX and DBMS Reference - 31 MAR 2000

Next Previous Up Top Contents Index