Next Previous Up Top Contents Index

4.6 Building an Automation server application

4.6.3 Defining type information for the dispinterface

To define type information for dispinterface, create an instance of the class <disp-type-info>, page 203. We continue the example above by defining type information suitable for <my-dispatch-object>.

If you wanted the my-property slot in the example above to be an OLE Automation property that a controller can read or write, you could define type information like this:

define constant $my-type-info = 
  make(<disp-type-info>, 
       properties: vector(make(<variable-description>,
                               name: "value",
                               documentation: "some value",
                               getter: my-property,
                               setter: my-property-setter)));

The name: option specifies the property name that the controller will see; the Dylan class and function names will not be visible externally.

If you wish, you can deny either read or write access by suppling getter: or setter: values of #f respectively.

The documentation: is optional; it corresponds what is called a "helpstring" in IDL.

Note that a property does not have to correspond to a slot. It simply needs an accessor method specialized on the class. Any number of properties could be specified as elements of the vector. The DISPID values will be assigned automatically; your server does not need to know what they are, because the controller will ask for them by name.

Note that setter: #f simply means that the controller cannot change the value--not that it is necessarily a constant. You can specify a property that really is just a constant value like this:

...
properties: vector(... make(<constant-description>, 
                          name: "pi",
                          value: 3.1416),
                        ...

In this case, the type information contains the complete implementation of the property; no slot or accessor functions are needed.


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

Next Previous Up Top Contents Index