Need to use active window

This commit is contained in:
Jaex 2014-08-13 15:57:41 +03:00
parent c289dfd124
commit cf30a7d949
2 changed files with 4 additions and 2 deletions

View file

@ -101,8 +101,7 @@ public string FileName
/// <returns>True if the user presses OK else false</returns>
public bool ShowDialog()
{
IntPtr activeWindow = NativeMethods.GetForegroundWindow();
return ShowDialog(activeWindow);
return ShowDialog(NativeMethods.GetActiveWindow());
}
/// <summary>

View file

@ -85,6 +85,9 @@ public static partial class NativeMethods
[DllImport("user32.dll")]
public static extern IntPtr FindWindowEx(IntPtr parentHwnd, IntPtr childAfterHwnd, IntPtr className, string windowText);
[DllImport("user32.dll")]
public static extern IntPtr GetActiveWindow();
[DllImport("user32.dll")]
public static extern bool GetClientRect(IntPtr hWnd, out RECT lpRect);