diff --git a/renderdocui/Code/Win32PInvoke.cs b/renderdocui/Code/Win32PInvoke.cs index b51326418..0758f417a 100644 --- a/renderdocui/Code/Win32PInvoke.cs +++ b/renderdocui/Code/Win32PInvoke.cs @@ -36,9 +36,22 @@ namespace renderdocui.Code [DllImport("kernel32", SetLastError = true, CharSet = CharSet.Unicode)] public static extern IntPtr LoadLibrary(string lpFileName); + [StructLayout(LayoutKind.Sequential)] + public struct POINT + { + public int X; + public int Y; + + public POINT(int x, int y) + { + this.X = x; + this.Y = y; + } + } + // for redirecting mousewheel [DllImport("user32.dll")] - public static extern IntPtr WindowFromPoint(int xPoint, int yPoint); + public static extern IntPtr WindowFromPoint(POINT pt); [DllImport("user32.dll")] public static extern IntPtr SendMessage(IntPtr wnd, int msg, IntPtr wp, IntPtr lp); diff --git a/renderdocui/Windows/MainWindow.cs b/renderdocui/Windows/MainWindow.cs index 8d221aa9a..4da57844f 100644 --- a/renderdocui/Windows/MainWindow.cs +++ b/renderdocui/Windows/MainWindow.cs @@ -51,7 +51,9 @@ namespace renderdocui.Windows short x = (short)((pos >> 0) & 0xffff); short y = (short)((pos >> 16) & 0xffff); - IntPtr wnd = Win32PInvoke.WindowFromPoint((int)x, (int)y); + Win32PInvoke.POINT pt = new Win32PInvoke.POINT((int)x, (int)y); + + IntPtr wnd = Win32PInvoke.WindowFromPoint(pt); if (wnd != IntPtr.Zero && wnd != m.HWnd && Control.FromHandle(wnd) != null) {