The callback function has the following format. You can specify any name for this function.
public void CallBackProc(short Id, int wParam, int lParam, void *Param);
Unsafe context is required for any operation involving pointers.
Add the unsafe keyword to the created callback routine.
unsafe public void CallBackProc(short Id,
int wParam, int lParam, void *Param)
{
.
.
.
In Visual C#, please use delegate to handle a function pointer.
The delegate declarations for each callback routine are written in the
CdioCs.cs file.
Interval timer |
PTM_INTERVAL_CALLBAC |
Please use the following functions to register callback functions.
Interval timer |
TimTimerCallBackProc |
.Initializing delegate
.To prevent the garbage collector from moving the delegate used for interrupt
processing, get the GCHandle
.Get a stable pointer to the delegate used for interrupt processing
.Register the retrieved stable pointer by using functions such as TimTimerCallBackProc
function
.Release the GCHandle for the delegate used for interrupt processing, when
it become unnecessary (for example, when the application terminates)
For the details of coding, please refer to sample programs and Notes on using with Visual C#.