In my experience the <<Get Window Size
method is not reliable. The issue is that <<Get Window Size
does not return physical pixels but logical pixels (affected by Windows display scaling), while <<Move Window( x, y )
uses physical pixels. Also, JMP in general and <<Get Window Size
in specific does not update when the Windows display scaling changes (if a user starts JMP on a laptop and later hooks up a monitor, for instance).
I run the following PowerShell script from JMP to get the actual screen resolution and use this info to place windows as appropriate (you'll have to launch powershell with -ExecutionPolicy Bypass
:
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class PInvoke {
[DllImport("user32.dll")] public static extern IntPtr GetDC(IntPtr hwnd);
[DllImport("gdi32.dll")] public static extern int GetDeviceCaps(IntPtr hdc, int nIndex);
}
"@
$hdc = [PInvoke]::GetDC([IntPtr]::Zero)
[PInvoke]::GetDeviceCaps($hdc, 118) # width
[PInvoke]::GetDeviceCaps($hdc, 117) # height
Jordan