<< Click to Display Table of Contents > OCX (ActiveX) |
1.OCX CCI Function Commands via Function Calls
•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
•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. |
---|
Figure 1: CCI OCX implementation for C# in Microsoft Visual Studio
The possible return values of the SAMLight Client Control function calls are normally just 0 or 1, but can also be a long, double or string value. |
---|
OCX CCI error |
Name |
Description |
---|---|---|
0 |
NOK |
Command did not work |
1 |
OK |
Command did work |
Table 390: OCX CCI function error return values
With the CCI command NewCciErrorReturn the extended error mode can be enabled. Possible function error return values for more detailed error analysis are: |
---|
OCX CCI error |
Name |
Description |
---|---|---|
-10000 |
IDispatch error #17 |
no named entity found |
-10001 |
IDispatch error #18 |
job is empty |
-10002 |
IDispatch error #19 |
function returned 0 (not ok) |
-10003 |
IDispatch error #20 |
not allowed in 3D mode |
-10004 |
IDispatch error #22 |
no valid license |
-10006 |
IDispatch error #24 |
object out of field |
Table 391: OCX CCI function extended error return values
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 problem 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.