CntNotifyCarryBorrow


Function

Sets the carry/borrow notification. Supports multi-processing.

Format

Ret =CntNotifyCarryBorrow ( Id , hWnd )

Parameters

Id [ VB.NET: Short ] [ C, C++: short ] [ C#: short ] [ Python: ctypes.c_short ]
Specify the device ID retrieved from CntInit.

hWnd [ VB.NET: IntPtr ] [ C, C++: HWND ] [ C#: IntPtr ] [ Python: ctypes.wintypes.HANDLE ]
Specify the window handle that receives the notify of carry/borrow.
The window handle can be retrieved by m_hWnd for VC.
Specify 0 when using callback without using window message.

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_SYS_RECOVERED_FROM_STANDBY

7

Execute the function CntResetDevice to return from the standby mode.

CNT_ERR_DLL_INVALID_ID

10001

Invalid ID 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_THREAD

10005

Failed in the creation of the thread (Failed in CreateThread).

CNT_ERR_DLL_HWND

10200

Window handle is invalid.

CNT_ERR_SYS_NOT_SUPPORTED

20001

This function can't be used by this device.

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

Remarks

Execute this function before the counter starts.

Interrupt is invalid if CntResetDevice is called.

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

The following messages are posted to the specified window handle when interrupt occurs.

Definition

Value

CNTM_CARRY_BORROW

1142H

The following message is posted to the specified window handle when interrupt occurs.
* HIWORD and LOWORD show the high-word and low-word.

Definition

Description

LOWORD(wParam)

Device ID Retrieved from CntInit

HIWORD(wParam)

Channel Number

LOWORD(lParam)

Notice Factor

Notic Factor can be given by the following logical sum.

[Definition of Notice Factor]

Definition

Value

Description

CNT_CB_CARRY

1

Carry

CNT_CB_BORROW

2

Borrow

Please refer to the sample program of each language for the describing details of message processing.

For Ethernet devices
  If communication with the device is lost, the process will be unregistered and events will no longer be notified.
  If you want to perform event notification again, please make the settings again using this function.

  You can check the registration status of the current process using the CntGetNetCommunicationInfo function.

Example

Sets the notify of carry/borrow.

VB.NET

Dim Ret As Integer
Ret = CntNotifyCarryBorrow ( Id , Handle )
 

C, C++

long Ret;
Ret = CntNotifyCarryBorrow ( Id , m_hWnd );
 

C#

int Ret;
Ret = cnt.NotifyCarryBorrow ( Id , Handle );
 

Python

Ret = ctypes.c_long()
handle = ctypes.windll.user32.FindWindowW(0, "Interrupt")
Ret.value = ccnt.CntNotifyCarryBorrow ( Id , handle )
 

See Also

CntStopNotifyCarryBorrow CntCarryBorrowCallbackProc CntGetNetCommunicationInfo