The event message routine has the following format.
It is a method of using the event message routine as a function of Visual Basic.NET (We call it VB.NET below).
When using WndProc, the event message routine is called whenever all events related to the application occur.
When using WndProc in VB.NET, there is no automatic code generation function,
so please describe the part codes of the event message routine manually.
Create the function according to the following procedure.
Function declaration
Using the structure Message in the class of System.Windows.Forms namespace,
you can get the information about messages sent from the system to
applications and controls.
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
Description of processing
Example : When output "Device Operation End Event has occurred"
If m.Msg = AIOM_AIE_END Then
Text_ErrorString.Text = "Device Operation End
Event has occurred"
End If
Base class WndProc processing
This processing should be performed after using the WndProc function.
MyBase.WndProc(m)
Combining from 1 to 3, the event message routine has the following form.
Protected Overrides Sub WndProc(ByRef m As System.Windows.Forms.Message)
If m.Msg = AIOM_AIE_END Then
Text_ErrorString.Text = "Device Operation End Event has occurred"
End If
MyBase.WndProc(m)
End Sub
To use event, it is necessary to set the window handle of application to driver.
Use the following functions to set event.
Analog Input |
AioSetAiEvent |
Analog Output |
AioSetAoEvent |
Counter |
AioSetCntEvent |
Timer |
AioSetTmEvent |
Specify the window handle to parameter hWnd by these event setting functions.
In Visual Basic.NET, member variable Handle in .NET Framework class is the window handle, so please specify this member variable to the parameter.
Ret = AioSetAiEvent ( Id , Handle , AiEvent) |
Ret = AioSetAoEvent ( Id , Handle , AoEvent ) |
Ret = AioSetCntEvent ( Id , CntChannel , Handle , CntEvent ) |
Ret = AioSetTmEvent ( Id , TimerId , Handle , TmEvent ) |