mirror of
https://github.com/mirror/processhacker
synced 2026-06-08 16:03:24 +00:00
child windows float by default
git-svn-id: svn://svn.code.sf.net/p/processhacker/code@1480 21ef857c-d57f-4fe0-8362-d861dc6d29cd
This commit is contained in:
@@ -44,6 +44,7 @@ namespace ProcessHacker
|
||||
/// The main Process Hacker window instance
|
||||
/// </summary>
|
||||
public static HackerWindow HackerWindow;
|
||||
public static IntPtr HackerWindowHandle;
|
||||
|
||||
public static ProcessAccess MinProcessQueryRights = ProcessAccess.QueryInformation;
|
||||
public static ProcessAccess MinProcessReadMemoryRights = ProcessAccess.VmRead;
|
||||
@@ -1211,6 +1212,32 @@ namespace ProcessHacker
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Floats the window on top of the main Process Hacker window.
|
||||
/// </summary>
|
||||
/// <param name="f">The form to float.</param>
|
||||
/// <remarks>
|
||||
/// Always call this method before calling InitializeComponent in order for the
|
||||
/// parent to be restored properly.
|
||||
/// </remarks>
|
||||
public static void SetPhParent(this Form f)
|
||||
{
|
||||
f.SetPhParent(true);
|
||||
}
|
||||
|
||||
public static void SetPhParent(this Form f, bool hideInTaskbar)
|
||||
{
|
||||
if (Properties.Settings.Default.FloatChildWindows)
|
||||
{
|
||||
if (hideInTaskbar)
|
||||
f.ShowInTaskbar = false;
|
||||
|
||||
IntPtr oldParent = Win32.SetWindowLongPtr(f.Handle, GetWindowLongOffset.HwndParent, Program.HackerWindowHandle);
|
||||
|
||||
f.FormClosing += (sender, e) => Win32.SetWindowLongPtr(f.Handle, GetWindowLongOffset.HwndParent, oldParent);
|
||||
}
|
||||
}
|
||||
|
||||
private static void windowAlwaysOnTopItemClicked(object sender, EventArgs e)
|
||||
{
|
||||
Form f = ((WeakReference<Form>)((MenuItem)sender).Tag).Target;
|
||||
|
||||
Reference in New Issue
Block a user