Introduction to COM – Step 9 of 12

9. You will be at the Add Method wizard. Be very careful here. For the "Method Name" field, type Sum. You will add three parameters. First, check the "in" attribute, then select LONG parameter type, then type "x" for the "Parameter Name", then click Add. Second, check the "in" attribute, then select LONG parameter type, then type "y" for the "Parameter Name", then click Add. Third, for the parameter type select *LONG, then for the parameter attributes select retval (which will automatically select "out" also), then type pRes for the parameter name. (See screenshot below). Click Add. Double-check everything, then click the Next button. COM methods return something called a HRESULT — typically used for error-checking — so the functional return value (in this case the sum of two long integers) must be stored in an out parameter.

Next: Step 10 of 12

Start: Step 0 of 12

Advertisements
This entry was posted in Software Test Automation. Bookmark the permalink.