<< Click to Display Table of Contents > 

Client Control Interface Manual > Implementation > OCX (ActiveX)

OCX (ActiveX)
Previous pageReturn to chapter overviewNext page

1.OCX CCI Function Commands via Function Calls

 

CCI_FunctionCommandsViaFunctionCalls

 

SAMLight can be controlled by a CCI application running on the same PC:

SAMLight → Settings → System → Remote → Function Calls must be enabled.

The client application can use all Function commands, see DLL Commands.

 

2.OCX CCI Function commands via TCP

 

CCI_FunctionCommandsViaTCP

 

SAMLight can be controlled by a CCI application running on a different PC. The SAM DLL (included in the SAMLight installer must be installed on the remote controlling PC, meaning that both system need to be a Windows PC.

Both Windows PCs are connected via TCP (Ethernet).

SAMLight → Settings → System → Remote:

oTCP must be enabled.

oIP Address must be one of the available IP addresses of the PC on which SAMLight is running and is independent of the IP of the sender of the CCI commands. Use 0.0.0.0 to allow remote control from any IP or 127.0.0.1 for local host.

The client application can use all Function commands, see DLL Commands.

If MultiInstance is used with two or more instances of SAMLight which should be controlled by one CCI application, different TCP connections (127.0.0.1, different Ports) have to be set in every instance of SAMLight together with two or more SAMLight Client Control OCX with different names in the CCI application. If just one TCP connection is closed by ScCloseEthernetConnection(), then TCP mode is also getting disabled and CCI switches to function call mode, which could lead to incorrect CCI function return values. So it is better to close all TCP connection and eventually reopen them all again.

Client Control has to be initialized at a STAThread. Otherwise windows will create a temporary STAThread, which will be closed automatically after 5 minutes.

 

Steps for the custom program to use OCX (ActiveX) CCI:

Initialize COM

Instantiate ActiveX control SCAPS.ScSamlightClientCtrl

If TCP, connect via ScOpenTCPConnection

Call desired functions

Figure 1 illustrates how to use SCAPS.ScSamlightClientCtrl with Microsoft Visual Studio: This SAMLight Client Control implementation is simply linked via drag and drop of the SAMLight Client Control ocx onto the form of the SAMLight Client Control application.

Please start at the Toolbox at the right hand side and follow the red arrows.

SAMLight_Client_Control

Figure 1: CCI OCX implementation for C# in Microsoft Visual Studio

Error code

Description

0

Command failed

1

Command succeded

If NewCciErrorReturn is enabled, further error returns are possible:

-10000

No entity found with this name

-10001

Job is empty

-10002

Function returned 0 (not ok)

-10003

Not allowed in SAM3D mode

-10004

No valid license

-10006

Object out of field

Table 414: CCI OCX (ActiveX) error codes

The maximum size of individual strings in TCP mode is 511 characters.

Note on versions: sc_samlight_client_ctrl.ocx, since installer 3.3.5 Build 232 to 3.4.5 Build 148 also a 64 bit version is available: sc_samlight_client_ctrl_x64.ocx. Because of a 8.3 filename convention issue with sc_samlight_client_ctrl.ocx the name of the 64 bit version was changed to sc_x64_samlight_client_ctrl.ocx with installer 3.4.5 Build 149.