Fix WindowFromPoint P/Invoke

This commit is contained in:
baldurk
2014-10-06 17:40:30 +01:00
parent 56e7f0c754
commit 2cebc9866f
2 changed files with 17 additions and 2 deletions
+14 -1
View File
@@ -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);
+3 -1
View File
@@ -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)
{