An argument whose value will be modified by a DLL function needs to be passed either by using an InOutArgument, if the value can be changed, or by using an OutArgument.
This example uses the GetCursorPos function of the user32.dll in order to retrieve the current cursor position.
@Dll( "user32.dll" ) public interface IUserDll32Functions { int GetCursorPos( OutArgument<Point> point); }
IUserDll32Functions user32Function = DllCall.createAgentDllCall(IUserDll32Functions.class, desktop); OutArgument<Point> point = new OutArgument<Point>(Point.class); user32Function.GetCursorPos(point); System.out.println("cursor position = " + point.getValue());