Programming Guide



sm_obj_set_property

Sets the value of a property of a service component or ActiveX control

int sm_obj_set_property(int obj_id, char *prop, char *val);

obj_id
An integer handle that identifies the object whose property you want to set. The handle is returned through sm_obj_create for service components, sm_obj_create or sm_obj_call for Java Objects, and sm_prop_id for ActiveX controls.

prop
The designated property. Refer to the Description for information about available properties.

val
The value to set for the specified property or property item. Panther converts the value to the type expected by the component.

If the value needs to be sent as an object ID, @obj() can be used to specify the object ID. For an example of its usage, see the example under sm_com_load_picture.

Environment

COM, EJB, Java

Scope

Client

Returns

Description

sm_obj_set_property sets the value of the specified property of a service component or ActiveX control.

When setting properties for ActiveX controls, this function can be used on all platforms for CLSID and Control Name and only on Windows for properties of the ActiveX control itself.

Properties can be determined through the AxView utility for COM components, the Properties window for ActiveX controls, or the Component Interface window for service components.

In property specifications, periods are allowed. For example:

sm_obj_set_property(Excel_Sheet,
"ActiveSheet.Cells(1,1).Value", text)

For indexed properties, use brackets to specify the occurrence. For example:

sm_obj_set_property(id, "prop[5]", value)

Example

#include <smuprapi.h>
int id;
int retcode;

{
id = sm_prop_id("spinner");
retcode = sm_obj_set_property(id, "Value", "40");
}

See Also

sm_obj_get_property