A volte capita di dover richiamare anche dal codice VB.NET delle funzioni contenute nelle API di sistema; in questi casi, il più grosso problema è quello della conversione tra il tipo di dato definito nelle API e il relativo tipo di dato definito nel mondo VB.NET.
Parametro Win32 | Tipo VB.NET |
---|---|
BYTE | ByVal As Byte |
CHAR | ByVal As Char |
DWORD | ByVal As Integer |
HWND | ByVal As IntPtr |
INT | ByVal As Integer |
LONG | ByVal As Integer |
LPBYTE | ByRef As Byte |
LPCHAR | ByRef As Char |
LPDWORD | ByRef As Integer |
LPLONG | ByRef As Integer |
LPSHORT | ByRef As Short |
LPSTR | ByVal As String |
LPWORD | ByRef As Short |
SHORT | ByVal As Short |
ULONG | ByVal As Integer |
USHORT | ByVal As Short |
WORD | ByVal As Short |
A quick reference : PInvoke.NET