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
This commit is contained in:
wj32
2009-03-01 03:50:13 +00:00
parent 72ea054dc1
commit 896fc3faad
2 changed files with 6 additions and 5 deletions
+6 -3
View File
@@ -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);
}
}
-2
View File
@@ -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;