AX_NEWVAL

Modify an ActiveX callback routine’s parameter

WSupported on Windows

 

 

 

xcall AX_NEWVAL(argument, new_value)

or

return = %AX_NEWVAL(argument, new_value)

return

Always returns 1. (i)

argument

The argument of a callback routine. (This is not a string that contains the name of the argument but the argument itself.) (a or n)

new_value

The new value to be assigned to that argument. (a or n)

All arguments that are passed to a bound callback routine are read-only and cannot be modified directly. Usually this situation presents no problems, because most callbacks that are defined by ActiveX controls either have no parameters or, if they do have parameters, the parameters are for information access only. Some ActiveX controls, however, require that information be returned to them by one or more callback parameters. In this case, you can use AX_NEWVAL.

Note that argument differs from the other name parameters in the ActiveX API, which specify the name as a string. For example, suppose you have the numeric argument level defined for a callback routine. To change the value to 5, you might use the following call:

xcall ax_newval(level, 5)

but not

xcall ax_newval("level", 5)

Any parameter modifications made by AX_NEWVAL are not returned to the calling ActiveX control until the callback routine returns.

If you call AX_NEWVAL for something that passes a VT_BSTR argument, the length of the string changes to the length of new_value. AX_NEWVAL may also change the data type of an argument if the ActiveX control defines the argument as VT_VARIANT. Variant data types must be passed by reference.

Note

When developing ActiveX controls in C++, Delphi, or other native languages, be sure to pass modifiable arguments as variants that have the VT_BYREF flag set. If the reference is to another variant, that variant must also have VT_BYREF, and so on. In other words, the argument cannot resolve to a value-type variant at any level. The ultimate dereference must resolve to a primitive type. Thus, a variant of type VT_BYREF | VT_I4 will work, but one of type VT_BYREF | VT_VARIANT will generate a “Writing to a literal” error unless the variant referred to is also a VT_BYREF variant.

We recommend that you XCALL AX_NEWVAL instead of accessing it as a function.