Programming Guide |
Instantiate a COM object
int sm_obj_create_server(char *object);
object
- The service component to instantiate.
COM
sm_obj_create_server
instantiates a COM service component. It is needed because some COM components cannot be instantiated by sm_obj_create. A notable example is the Crystal ReportsCrystalRuntime.Application
component. Before invoking this function, you must set@app()->current_component_system
toPV_SERVER_COM
. This function was first released in Panther 5.10.
// This JPL code assmes that the screen has a Crystal Reports
// 'Crystal ActiveX Report Viewer Control 11.5' ActiveX field
// named 'myReport'.
vars reportObj, applicObj
@app()->current_component_system = PV_SERVER_COM
applicObj = sm_obj_create_server("CrystalRuntime.Application")
// reportPfad is the file name of a Crystal Reports report file.
proc ViewReport (reportPfad)
{
if applicObj > 0
{
reportObj = sm_obj_call(applicObj, "OpenReport", reportPfad)
if reportObj > 0
{
sm_obj_set_property(myReport->id, "ReportSource", reportObj)
sm_obj_call (myReport->id, "ViewReport")
sm_obj_delete_id (reportObj)
}
}
}