An argument whose value will be modified by a DLL function needs to be declared using the ByRef keyword.
This example uses the GetCursorPos function of the user32.dll in order to retrieve the current cursor position.
<Dll( "user32.dll" )> Public Interface IUserDll32Functions Function GetCursorPos( ByRef point As Point) As Integer End Interface
Public Sub Main()
Dim user32Functions As IUserDll32Functions = DllCall.CreateAgentDllCall( Of IUserDll32Functions)()
Dim point As Point
user32Functions.GetCursorPos(point)
MsgBox( "cursor position = (" & point.X & ", " & point.Y & ")" )
End Sub