From a0fc65e612800ebcfdefaedd1a90341cc23b348f Mon Sep 17 00:00:00 2001 From: wj32 Date: Sat, 21 Feb 2009 11:02:59 +0000 Subject: [PATCH] improved Start hidden git-svn-id: svn://svn.code.sf.net/p/processhacker/code@698 21ef857c-d57f-4fe0-8362-d861dc6d29cd --- trunk/ProcessHacker/Forms/HackerWindow.cs | 15 ++++++++++++--- trunk/ProcessHacker/Program.cs | 6 +++++- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/trunk/ProcessHacker/Forms/HackerWindow.cs b/trunk/ProcessHacker/Forms/HackerWindow.cs index 9eaf215d3..4107c4dd7 100644 --- a/trunk/ProcessHacker/Forms/HackerWindow.cs +++ b/trunk/ProcessHacker/Forms/HackerWindow.cs @@ -2106,6 +2106,9 @@ namespace ProcessHacker LoadSettings(); + if (Properties.Settings.Default.StartHidden || Program.StartMinimized) + this.Location = new Point(-3200, -3200); + // load symbols on a separate thread Thread t = new Thread(new ThreadStart(delegate { @@ -2148,13 +2151,19 @@ namespace ProcessHacker if (Properties.Settings.Default.StartHidden || Program.StartMinimized) { - // HACK: I can't seem to be able to hide the window here, so I have to use a timer! + // HACK System.Windows.Forms.Timer t2 = new System.Windows.Forms.Timer(); - t2.Interval = 10; + t2.Interval = 1; t2.Tick += - (sender_, e_) => { this.Hide(); t2.Enabled = false; }; + (sender_, e_) => + { + t2.Enabled = false; + this.Hide(); + this.Location = Properties.Settings.Default.WindowLocation; + t2.Dispose(); + }; t2.Enabled = true; } diff --git a/trunk/ProcessHacker/Program.cs b/trunk/ProcessHacker/Program.cs index a9bfa0645..c412bf7a4 100644 --- a/trunk/ProcessHacker/Program.cs +++ b/trunk/ProcessHacker/Program.cs @@ -209,7 +209,11 @@ namespace ProcessHacker Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); - Application.Run(HackerWindow = new HackerWindow()); + Application.Run(HackerWindow = new HackerWindow() + { + Location = new Point(-3200, -3200), + StartPosition = FormStartPosition.Manual + }); } public static void StartProcessHackerAdmin()