improved menu performance and folder browser fix

This commit is contained in:
Frank Skare
2021-09-05 08:23:42 +02:00
parent e4c65cd84e
commit 7a6b2011e4
7 changed files with 49 additions and 115 deletions

View File

@@ -7,6 +7,7 @@ using System.ComponentModel;
using System.Diagnostics;
using System.Drawing.Text;
using System.Linq;
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Interop;
@@ -101,8 +102,8 @@ namespace MsgBoxEx
public static IntPtr GetOwnerHandle()
{
IntPtr foregroundWindow = Native.GetForegroundWindow();
Native.GetWindowThreadProcessId(foregroundWindow, out var procID);
IntPtr foregroundWindow = GetForegroundWindow();
GetWindowThreadProcessId(foregroundWindow, out var procID);
using (var proc = Process.GetCurrentProcess())
if (proc.Id == procID)
@@ -111,6 +112,12 @@ namespace MsgBoxEx
return IntPtr.Zero;
}
[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
public static Color ColorFromString(string colorString)
{
Color wpfColor = Colors.Black;

View File

@@ -1,15 +0,0 @@

using System;
using System.Runtime.InteropServices;
namespace MsgBoxEx
{
class Native
{
[DllImport("user32.dll")]
public static extern IntPtr GetForegroundWindow();
[DllImport("user32.dll")]
public static extern uint GetWindowThreadProcessId(IntPtr hWnd, out uint lpdwProcessId);
}
}