# ctaSetParmByNameEx

Modifies a given parameter on a particular Natural Access Server.

#### Prototype

DWORD ctaSetParmByNameEx ( char addr, CTAHD ctahd, char *parmname, void *buffer, unsigned size)

Argument | Description
addr | Natural Access Server address.
ctahd | Context handle that specifies the server on which commands are executed. ctahd can be a void context handle.
parmname | Pointer to a string that specifies the name of the parameter. See the Details section for the parmname format.
buffer | Pointer to a buffer that contains the new values of the named parameter.
size | Size of buffer in bytes.

#### Return values

Return value | Description
SUCCESS |
CTAERR_BAD_ARGUMENT | buffer is NULL.
CTAERR_BAD_SIZE | buffer size does not match the size of the parameter field data.
CTAERR_INVALID_CTAHD | An invalid context handle was passed as an argument to a function, or the context was destroyed by another thread.
CTAERR_NOT_FOUND | parmname was not found.
CTAERR_NOT_INITIALIZED | Natural Access is not initialized. Call ctaInitialize first.
CTAERR_SVR_COMM | Server communication error.

#### Details

Use ctaSetParmByNameEx to set the values of the named parameter. If ctahd is a valid context, this function modifies the parameters from the context defaults.

ctahd can be a void context handle. A void context handle refers only to the server on which the commands are executed and not to any real context object. Each server has a unique void context handle.

If ctahd is a void context handle, this function retrieves parameters from the global defaults and executes on the server specified by the void context handle. Global defaults are either statically defined values maintained within a process or dynamically defined values maintained by the Natural Access Server.

If the context handle is equal to NULL_CTAHD, the function retrieves parameters from the server specified by addr. If addr is equal to NULL or is an empty string, the function retrieves parameters from the default server.

The parmname format is svcname[.x].structname[.fieldname].

An example of parmname is vce.play.gain.

You can retrieve the values of parameters using ctaGetParmsEx or ctaGetParmByNameEx.

Refer to Managing parameters for more information.

#### See also

ctaGetParmByName, ctaGetParmID, ctaGetParmIds, ctaGetParmIdsEx, ctaGetParmInfo, ctaGetParmInfoEx, ctaGetParms, ctaSetParmByName

#### Example

void DemoSetContextPlayGain(CTAHD ctahd, INT32 newgain)
{
INT32 oldgain;
ctaGetParmByNameEx( "localhost", ctahd, "vce.play.gain",
&oldgain, sizeof(oldgain) );
ctaSetParmByNameEx( "localhost", ctahd, "vce.play.gain",
&newgain, sizeof(newgain) );
printf( "CTAHD=%x vce.play.gain is now %d dB (old value = %d dB)\n",
ctahd, newgain, oldgain);
}