This approach is useful if the type library is not available at compile time or you want to allow methods to be called dynamically without knowing the interface pointer type at compile-time. It can be less efficient than using the approach in Calling Automation methods using a type library, but is often the simplest approach, especially if the Automation component was written to be called from a language like Visual Basic.
There are three kinds of Automation method, each of which is called using functions designed for the purpose.
setfform of invoke-dispatch-method can be used to call property setter methods.
setfform of invoke-dispatch-get-property.
To use these function, you need to specify a COM interface pointer for the i-dispatch interface, the method name and suitable arguments. The method name is given as a string or integer and the COM interface pointer is a foreign pointer of type com-interface. In all the functions, the arg s and value s are as specified in the Data conversion when calling Automation methods.