Skip to content

Commit 867e6fa

Browse files
committed
Lister form has an owner.
1 parent 8d5fdbb commit 867e6fa

File tree

3 files changed

+21
-1
lines changed

3 files changed

+21
-1
lines changed

Wlx2Explorer/Forms/MainForm.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,8 @@ private void ShowListerForm()
214214
}
215215
else
216216
{
217-
_listerForm.Show();
217+
var foregroundWindowHandle = NativeMethods.GetForegroundWindow();
218+
_listerForm.Show(new Win32WindowWrapper(foregroundWindowHandle));
218219
_listerForm.Activate();
219220
}
220221
}

Wlx2Explorer/Win32WindowWrapper.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
using System;
2+
using System.Collections.Generic;
3+
using System.Linq;
4+
using System.Text;
5+
using System.Windows.Forms;
6+
7+
namespace Wlx2Explorer
8+
{
9+
class Win32WindowWrapper : IWin32Window
10+
{
11+
public IntPtr Handle { get; private set; }
12+
13+
public Win32WindowWrapper(IntPtr handle)
14+
{
15+
Handle = handle;
16+
}
17+
}
18+
}

Wlx2Explorer/Wlx2Explorer.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@
104104
</Compile>
105105
<Compile Include="Program.cs" />
106106
<Compile Include="Properties\AssemblyInfo.cs" />
107+
<Compile Include="Win32WindowWrapper.cs" />
107108
<EmbeddedResource Include="Forms\AboutForm.resx">
108109
<DependentUpon>AboutForm.cs</DependentUpon>
109110
</EmbeddedResource>

0 commit comments

Comments
 (0)