Function
Sets the notify of counter error (Abnormal input error, Filter error, Alarm error). Supports multi-processing.
Format
Ret =CntNotifyCounterError ( 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 counter error.
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 message is posted to the specified window handle when interrupt occurs.
Definition |
Value |
CNTM_COUNTER_ERROR |
1141H |
The following information are contained in
wParam and lParam that is the parameter of the message respectively.
* 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) |
Error kind |
[Definition of error kind]
Definition |
Value |
Description |
CNT_AI_ERROR |
1 |
Abnormal input error |
CNT_FLT_ERROR |
2 |
Filter error |
CNT_ALM_ERROR |
3 |
Alarm error |
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 counter error.
VB.NET |
Dim Ret As Integer |
C, C++ |
long Ret; |
C# |
int Ret; |
Python |
Ret = ctypes.c_long() |
See Also
CntStopNotifyCounterError CntCounterErrorCallbackProc CntGetNetCommunicationInfo