CntInit


Function

Retrieves the device ID, then the device could be accessed. Supports multi-processing.

Format

Ret = CntInit ( DeviceName , Id )

Parameters

DeviceName [ VB.NET: String ] [ C, C++: char * ] [ C#: string ] [ Python: ctypes.c_char_p ]
Specify the device name set with the device manager.

Id [ VB.NET: Short ] [ C, C++: short * ] [ C#: out short ] [ Python: ctypes.POINTER(ctypes.c_short) ]
A device ID is returned. By using this device ID, you could access the device in the following functions.

Return Value

Ret [ VB.NET: Integer ] [ C, C++: long ] [ C#: int ] [ Python: ctypes.c_long ]

Definition

Value

Description

CNT_ERR_SUCCESS

0

Normality completion

CNT_ERR_INI_MEMORY

3

Failed in the allocation of the memory.

CNT_ERR_INI_REGISTRY

4

Failed in the access of registry.

CNT_ERR_SYS_RECOVERED_FROM_STANDBY

7

Execute the function CntResetDevice to return from the standby mode.

CNT_ERR_INI_NOT_FOUND_SYS_FILE

8

Because the ccnt.sys file is not found, it is not possible to initialize it.

CNT_ERR_INI_DLL_FILE_VERSION

9

Because the version information on the ccnt.dll file cannot be retrieved, it is not possible to initialize it.

CNT_ERR_INI_SYS_FILE_VERSION

10

Because the version information on the ccnt.sys file cannot be retrieved, it is not possible to initialize it.

CNT_ERR_INI_NO_MATCH_DRV_VERSION

11

Because the version information of ccnt.dll is not corresponding to the version information of ccnt.sys, it is not possible to initialize it.

CNT_ERR_DLL_DEVICE_NAME

10000

The device name which wasn't registered by a device manager was specified.

CNT_ERR_DLL_CALL_DRIVER

10002

CNT driver can't be called (Failed in the device I/O control).

CNT_ERR_DLL_CREATE_FILE

10003

Failed in the creation of the file (Failed in CreateFile).

CNT_ERR_INFO_INVALID_DEVICE

10050

The specified device name is not found. Please check spelling.

CNT_ERR_INFO_NOT_FIND_DEVICE

10051

No more device.

The others: (See also: Details of Error Code)

Initial Value

None

Remarks

Retrieves the device ID, then the device could be accessed. By using this device ID, you could access the device in the following functions.

When accessing several devices, please prepare several variables to store the IDs. After the CntInit completed normally, and before the CntExit is called, every function can be used.

The number of processes that can access one device varies depending on the device. For details, please refer to the list of the number of available processes.

Please be sure to connect the device on your PC before you execute your application software.
Otherwise, There is possibility to occur the error with CntInit() function.

Example

Initializes the device "CNT000" and retrieves the Id.

VB.NET

Dim Ret As Integer
Dim Id As Short
Ret = CntInit ( "CNT000" , Id )
 

C, C++

long Ret;
short Id;
Ret = CntInit ( "CNT000" , &Id );
 

C#
 

int Ret;
short Id;
Ret = cnt.Init ( "CNT000" , out Id );
 

Python

Ret = ctypes.c_long()
Id = ctypes.c_short()
Ret.value = ccnt.CntInit ( "CNT000" , ctypes.byref(Id) )
 

See Also

CntExit