Browse Source

Add SetLastError to all necessary winapis.

Justin 2 years ago
parent
commit
121bfb473c
1 changed files with 5 additions and 5 deletions
  1. 5 5
      fis/Win/WindowDragingHelper.cs

+ 5 - 5
fis/Win/WindowDragingHelper.cs

@@ -748,7 +748,7 @@ namespace fis.Win
            int threadId
            );
 
-        [DllImport("user32.dll")]
+        [DllImport("user32.dll", SetLastError = true)]
         private static extern int CallNextHookEx(
            IntPtr hHook,
            int nCode,
@@ -756,16 +756,16 @@ namespace fis.Win
            IntPtr lParam
            );
 
-        [DllImport("user32.dll", CharSet = CharSet.Auto)]
+        [DllImport("user32.dll", SetLastError = true)]
         private static extern bool UnhookWindowsHookEx(IntPtr hHook);
 
-        [DllImport("user32.dll", CharSet = CharSet.Auto)]
+        [DllImport("user32.dll", SetLastError = true)]
         private static extern bool GetCursorPos(out POINT pt);
 
-        [DllImport("user32.dll", CharSet = CharSet.Auto)]
+        [DllImport("user32.dll", SetLastError = true)]
         private static extern bool GetWindowRect(IntPtr hwnd, out RECT lpRect);
 
-        [DllImport("user32.dll", CharSet = CharSet.Auto)]
+        [DllImport("user32.dll", SetLastError = true)]
         private static extern bool MoveWindow(IntPtr hWnd, int X, int Y, int nWidth, int nHeight, bool bRepaint);
 
         private static readonly Dictionary<string, IntPtr> _windowHandles = new Dictionary<string, IntPtr>();