Method calls more complex than the PropertyGet and PropertyPut examples shown in the preceding section require extensive setup work. Before you can call the Invoke function, each argument must be placed into the argument array. After the Invoke function call, any variant arguments that were allocated (created BSTR or SAFEARRAY values) must be freed. Creating arrays of BSTR values requires repetitive allocation, testing, and error handling.
The functions provided in dispargs.c on the sample disk (in the sample\autoxl directory) were written to simplify these tasks. The following procedure shows how to use these functions:
The following sections discuss the argument-constructor functions and the Invoke function in more detail.