The functions which are same as the form of WIN32API are used. There is not any function which is exclusively used for Visual Basic .Net.
The contents of the parameters and the return
value of a function are independent of the development language, and are
common.
Please refer to the function reference of each driver for details.
Visual Basic .NET has a different data type
than previous versions of Visual Basic 5.0 and 6.0.
Please be careful when using the application created in the old version.
When notifying an interval timer event by
using callback function in Visual Basic .NET,
it is required to fix the callback function's memory address.
The following code is the sample to process
an interval timer event.
For details, please refer to the sample programs.
- Declaring as global variables.
Dim gCh As GCHandle
Dim pdelegate_func As PTM_INTERVAL_CALLBACK
Dim pfunc As IntPtr
- In the Load method, initializing the delegate for interrupt process, and add a reference to prevent garbage collection from being destroyed.
pdelegate_func = New PTM_INTERVAL_CALLBACK(AddressOf
CallBackProc)
gCh = GCHandle.Alloc(pdelegate_func)
- In the Close method, releasing the handle.
gCh.Free()
- Retrieving the fixed function pointer.
pfunc = Marshal.GetFunctionPointerForDelegate(pdelegate_func)
- Specifying the retrieved fixed pointer by function TimTimerCallBackProc.
Ret = TimTimerCallBackProc(Id, pfunc, Temp)