Contents Previous Next Subchapters

Saving a COM Server Dispatch Pointer
Syntax codispsave(object IDobject name)
See Also codispset

Description
Saves the COM IDispatch pointer specified by the character row vector object name with the identifier specified by the character row vector object ID. The value of object ID may be used in subsequent calls to codispset to set the IDispatch pointer value in other COM objects or servers.

Example
If at the command prompt you enter
     clear     
     cocreate("Avis.AvFileLoader");
     fileName = [OM_INSTALL, "\example\automation\craterlake.h5"]
     coinvoke("Load", fileName)
O-Matrix will create a connection to the Array Viewer Avis.AvFileLoader object and load the sample data file craterlake.h5. The Avis.AvFileLoader server contains objects which may be required by other Array Viewer objects. If you continue the example above by entering
     codispsave("Avis.Root", "Root")   # save IDispatch* for Root object to ID Avis.Root
O-Matrix will save a reference to the Root IDispatch pointer with an identifier reference Avis.Root. This identifier can be used to set the saved IDispatch pointer to an object in another server. If you continue the example above by entering
     cocreate("ArrayViewer.Document")
     codispset("RootGroup", "Avis.Root")    # Set ArrayViewer.Document.RootGroup to saved IDispatch
     copropput("Visible", 1)
O-Matrix will create a new instance of the Array Viewer and set the IDispatch pointer of the Array Viewer RootGroup object to the value referenced by Avis.Root.