Win32API format
* Not compatible with Universal Windows Platform (UWP).
The contents of the parameters and the return
value of functions are common regardless of the development language.
Please refer to the function reference 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.
In Visual Basic .NET, when notifying an interrupt using a callback function, it is required to add processing to fix the memory address of the callback function.
As an example of the code necessary for these
processes, we will use interrupt processing as an example.
For details, please refer to the sample programs.
■Declaring as global variables.
Dim gCh As GCHandle
Dim pdelegate_func As PINTCALLBACK
Dim pfunc As IntPtr
■In the Load method, initialize the interrupt handler delegate, and add a reference to it so it will not be destroyed by garbage collection.
pdelegate_func = New PINTCALLBACK(AddressOf
CallBackProc)
gCh = GCHandle.Alloc(pdelegate_func)
■In the Closed method, release the handle.
gCh.Free()
■Retrieving the fixed function pointer.
pfunc = Marshal.GetFunctionPointerForDelegate(pdelegate_func)
■In CanNotifyEvent, specify the retrieved fixed pointer.
Ret = CanNotifyEvent(Id, pfunc, Temp)