Visual Basic .NET
Function specifications
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.
Function parameters and return value
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.
Format of function reference
"VB" in the Format column indicates the format of Visual Basic 5 and 6.
The type declaration of Visual Basic .NET changed greatly from earlier versions.
Therefore, please refer to the function declaration in a sample program for the type of a parameter in the Format.
The example of changing the type declaration
Visual Basic 5,6 Visual Basic .NET
16Bit Integer -> Short
32Bit Long -> Integer
64Bit None -> Long
Any -> Peculiar data type
Notes of using callback function
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)