From 896fc3faad2b1f75e058509dedbb3c4d1eaa8e36 Mon Sep 17 00:00:00 2001 From: wj32 Date: Sun, 1 Mar 2009 03:50:13 +0000 Subject: [PATCH] fix for the unhandled exceptions resulting from the previous fix git-svn-id: svn://svn.code.sf.net/p/processhacker/code@793 21ef857c-d57f-4fe0-8362-d861dc6d29cd --- trunk/ProcessHacker/Forms/HackerWindow.cs | 9 ++++++--- trunk/ProcessHacker/Program.cs | 2 -- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/trunk/ProcessHacker/Forms/HackerWindow.cs b/trunk/ProcessHacker/Forms/HackerWindow.cs index bedfcb5f2..d8adbfc78 100644 --- a/trunk/ProcessHacker/Forms/HackerWindow.cs +++ b/trunk/ProcessHacker/Forms/HackerWindow.cs @@ -2000,6 +2000,11 @@ namespace ProcessHacker // Magic number - PH uses this to detect previous instances. if (m.Msg == 0x9991) { + this.Visible = true; + + if (this.WindowState == FormWindowState.Minimized) + this.WindowState = FormWindowState.Normal; + m.Result = new IntPtr(0x1119); return; @@ -2339,13 +2344,11 @@ namespace ProcessHacker catch { } - // If it's Vista and we're elevated, we should allow certain window message to allow + // If it's Vista and we're elevated, we should allow the magic window message to allow // Allow only one instance to work. if (Program.WindowsVersion == "Vista" && Program.ElevationType == Win32.TOKEN_ELEVATION_TYPE.TokenElevationTypeFull) { - Win32.ChangeWindowMessageFilter(Win32.WindowMessage.ShowWindow, Win32.UipiFilterFlag.Add); - Win32.ChangeWindowMessageFilter(Win32.WindowMessage.SysCommand, Win32.UipiFilterFlag.Add); Win32.ChangeWindowMessageFilter((Win32.WindowMessage)0x9991, Win32.UipiFilterFlag.Add); } } diff --git a/trunk/ProcessHacker/Program.cs b/trunk/ProcessHacker/Program.cs index 65dc2938d..5c70d7fd5 100644 --- a/trunk/ProcessHacker/Program.cs +++ b/trunk/ProcessHacker/Program.cs @@ -264,8 +264,6 @@ namespace ProcessHacker if (Win32.SendMessage(hWnd, (Win32.WindowMessage)0x9991, IntPtr.Zero, IntPtr.Zero).ToInt32() == 0x1119) { - Win32.SendMessage(hWnd, Win32.WindowMessage.SysCommand, new IntPtr(0xf120), IntPtr.Zero); - Win32.SendMessage(hWnd, Win32.WindowMessage.ShowWindow, IntPtr.Zero, IntPtr.Zero); Win32.SetForegroundWindow(hWnd); found = true; return false;