It is a method of using the event message routine as a function of Visual
C++.
When using DefWindowProc, the event message routine is called whenever
all events related to the application are generated.
Creating event message routine
In Class View, right-click on the
class to which you want to add the event message routine.
Then choose Add-Add Function. The Add Member Function Wizard
dialog box is displayed.
Create the function according to the following procedure.
Return type |
LRESULT |
Function name |
DefWindowProc |
Parameter list |
UINT |
Parameter name |
message |
Add |
Click the button |
Parameter list |
WPARAM |
Parameter name |
wParam |
Add |
Click the button |
Parameter list |
LPARAM |
Parameter name |
lParam |
Add |
Click the button |
Access |
protected |
Virtual |
Cleck the check box |
Click the Finish button after confirming that Function signature is as follows.
virtual LRESULT DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam);
Specifying Window Handle
To use events, it is necessary to set the
window handle of the application to the driver.
Use the following functions for event setting.
Count Match Notification |
|
Counter Error Notifiction |
|
Carry/Borrow Notification |
|
Timer Notification |
|
Sampling Stop Notification |
|
Specified Time Sampling Completion |
Specify the window handle to the hWnd parameter
in these event setting functions.
The m_hWnd member variable in MFC class contains the window handle In Visual
C++ .NET. Please specify the member variable "as is".
Ret = CntNotifyCountUp ( Id , 0 , 0 , 10000 , m_hWnd ); |
Ret = CntNotifyCounterError ( Id , m_hWnd ); |
Ret = CntNotifyCarryBorrow ( Id , m_hWnd ); |
Ret = CntNotifyTimer ( Id , 100 , m_hWnd ); |
Ret = CntNotifySamplingStop ( Id , m_hWnd ); |
Ret = CntNotifySamplingCount ( Id , m_hWnd ); |