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:
wj32
2009-06-28 01:58:43 +00:00
parent ab4c80dd41
commit 4248bb65dd
18 changed files with 152 additions and 60 deletions
+27
View File
@@ -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;