public void Stop() { if (!stopping) { stopping = true; Log("Shutting down..."); timer.Stop(); Log("Removing trayhook..."); if (IntPtr.Size == 8) { UnsetTrayHook64(); } else { UnsetTrayHook(); } Log("Trayhook removed"); if (restoreBalloonRegistryOnQuit) { RegHelper reghelper = new RegHelper(); Log("Enabling system balloons and refreshing environment..."); reghelper.set(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\EnableBalloonTips", "1", RegistryValueKind.DWord); reghelper.refreshenv(); // TODO Log("System balloon registry restored"); } started = false; stopping = false; System.Windows.Forms.Application.Exit(); } }
public void Stop() { if (!stopping) { stopping = true; Log("Shutting down..."); timer.Stop(); Log("Removing trayhook..."); if (IntPtr.Size == 8) UnsetTrayHook64(); else UnsetTrayHook(); Log("Trayhook removed"); if (restoreBalloonRegistryOnQuit) { RegHelper reghelper = new RegHelper(); Log("Enabling system balloons and refreshing environment..."); reghelper.set(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\EnableBalloonTips", "1", RegistryValueKind.DWord); reghelper.refreshenv(); // TODO Log("System balloon registry restored"); } started = false; stopping = false; System.Windows.Forms.Application.Exit(); } }
private bool Start(IntPtr hWnd) { bool ok = false; Log("Setting hook..."); string className = GetCurrentClassName(); Log("className: " + className); bool is64bit = Win32.Is64BitOperatingSystem(); Log("64-bit: " + is64bit.ToString()); Log("OS: " + Environment.OSVersion.VersionString); Log("XP: " + isXP.ToString()); bool res; if (is64bit) { res = SetTrayHook64(className); } else { res = SetTrayHook(className); } if (res) { Log("gTraySpy hook installed"); RegHelper reghelper = new RegHelper(); Object key = reghelper.get(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\EnableBalloonTips"); if (key != null && (int)key == 0) { Log("System balloons already disabled."); ok = true; } else { Log("Disabling system balloons...please wait a moment"); bool keynew = reghelper.set(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\EnableBalloonTips", "0", RegistryValueKind.DWord); if (!keynew) { Log("[!] Registry error. System balloon setting left unchanged."); } else { restoreBalloonRegistryOnQuit = true; if (reghelper.refreshenv()) { Log("Disabled system balloons"); ok = true; } else { Log("[!] Failed to update environment!"); } } } } else { Log("[!] gTraySpy hook error"); } started = ok; return(ok); }
private bool Start(IntPtr hWnd) { bool ok = false; Log("Setting hook..."); string className = GetCurrentClassName(); Log("className: " + className); bool is64bit = Win32.Is64BitOperatingSystem(); Log("64-bit: " + is64bit.ToString()); Log("OS: " + Environment.OSVersion.VersionString); Log("XP: " + isXP.ToString()); bool res; if (is64bit) res = SetTrayHook64(className); else res = SetTrayHook(className); if (res) { Log("gTraySpy hook installed"); RegHelper reghelper = new RegHelper(); Object key = reghelper.get(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\EnableBalloonTips"); if (key != null && (int)key == 0) { Log("System balloons already disabled."); ok = true; } else { Log("Disabling system balloons...please wait a moment"); bool keynew = reghelper.set(@"HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced\EnableBalloonTips", "0", RegistryValueKind.DWord); if (!keynew) { Log("[!] Registry error. System balloon setting left unchanged."); } else { restoreBalloonRegistryOnQuit = true; if (reghelper.refreshenv()) { Log("Disabled system balloons"); ok = true; } else { Log("[!] Failed to update environment!"); } } } } else { Log("[!] gTraySpy hook error"); } started = ok; return ok; }