I'm trying to simulate mouse input using SendInput
, however I need to determine the virtual screen width in case there are multiple monitors, to set the dx
and dy
values, for example:
dx = (x * 65536) / SystemInformation.VirtualScreen.Width;
dy = (y * 65536) / SystemInformation.VirtualScreen.Height;
The problem is that the monitors apparently have different DPI values, which results in an incorrect virtual size.
For reference, both SystemInformation.VirtualScreen.Size
and calls to GetSystemMetrics(SM_CXVIRTUALSCREEN)
return the same incorrect values.
I tried using GetSystemMetricsForDPI
with no success either.