Пример #1
0
        private void Painting()
        {
            if (isFirstPaint)
            {
                isFirstPaint = false;

                if (!Program.Recovered)
                {
                    ProcessHackerRestartRecovery.ApplicationRestartRecoveryManager.RegisterForRestart();
                    //ProcessHackerRestartRecovery.ApplicationRestartRecoveryManager.RegisterForRecovery();
                }

                this.CreateShutdownMenuItems();
                this.LoadFixMenuItems();
                this.LoadUac();
                this.LoadAddShortcuts();
                this.LoadFixNProcessHacker();

                toolStrip.Items.Add(new ToolStripSeparator());
                var targetButton = new TargetWindowButton();
                targetButton.TargetWindowFound += (pid, tid) => this.SelectProcess(pid);
                toolStrip.Items.Add(targetButton);

                var targetThreadButton = new TargetWindowButton();
                targetThreadButton.TargetWindowFound += (pid, tid) =>
                    {
                        Program.GetProcessWindow(processP.Dictionary[pid], (f) =>
                            {
                                Program.FocusWindow(f);
                                f.SelectThread(tid);
                            });
                    };
                targetThreadButton.Image = Properties.Resources.application_go;
                targetThreadButton.Text = "Find window and select thread";
                targetThreadButton.ToolTipText = "Find window and select thread";
                toolStrip.Items.Add(targetThreadButton);

                try { TerminalServerHandle.RegisterNotificationsCurrent(this, true); }
                catch (Exception ex) { Logging.Log(ex); }
                try { this.UpdateSessions(); }
                catch (Exception ex) { Logging.Log(ex); }

                try { Win32.SetProcessShutdownParameters(0x100, 0); }
                catch { }

                if (Properties.Settings.Default.AppUpdateAutomatic)
                    this.UpdateProgram(false);
            }
        }
Пример #2
0
        public HackerWindow()
        {
            InitializeComponent();

            if (OSVersion.HasExtendedTaskbar)
            {
                // We need to call this here or we don't receive the TaskbarButtonCreated message
                Windows7Taskbar.AllowWindowMessagesThroughUipi();
                Windows7Taskbar.AppId = "ProcessHacker";
                Windows7Taskbar.ProcessAppId = "ProcessHacker";

                thumbButtonManager = new ThumbButtonManager(this);
                thumbButtonManager.TaskbarButtonCreated += this.thumbButtonManager_TaskbarButtonCreated;
            }

            this.AddEscapeToClose();

            // Initialize action syncs
            _enableNetworkProviderSync = new ActionSync(
                () =>
                {
                    Program.NetworkProvider.Enabled = true;
                    Program.NetworkProvider.Boost();
                }, 2);

            _refreshHighlightingSync = new ActionSync(() => this.BeginInvoke(new MethodInvoker(this.treeProcesses.RefreshItems), null), 2);

            Logging.Logged += this.QueueMessage;
            this.LoadWindowSettings();
            this.LoadOtherSettings();
            this.LoadControls();
            this.LoadNotificationIcons();

            if ((!Settings.Instance.StartHidden && !Program.StartHidden) || Program.StartVisible)
            {
                this.Visible = true;
            }

            if (tabControl.SelectedTab == tabProcesses)
                treeProcesses.Tree.Select();

            this.LoadOther();
            this.LoadStructs();

            Program.ServiceProvider.Enabled = true;
            Program.ServiceProvider.Boost();

            ProcessHackerRestartRecovery.ApplicationRestartRecoveryManager.RegisterForRestart();
            //ProcessHackerRestartRecovery.ApplicationRestartRecoveryManager.RegisterForRecovery();

            this.CreateShutdownMenuItems();
            this.LoadFixOSSpecific();
            this.LoadUac();
            this.LoadAddShortcuts();
            this.LoadFixNProcessHacker();

            toolStrip.Items.Add(new ToolStripSeparator());
            var targetButton = new TargetWindowButton();
            targetButton.TargetWindowFound += (pid, tid) => this.SelectProcess(pid);
            toolStrip.Items.Add(targetButton);

            var targetThreadButton = new TargetWindowButton();
            targetThreadButton.TargetWindowFound += (pid, tid) => Program.GetProcessWindow(Program.ProcessProvider.Dictionary[pid], f =>
            {
                Program.FocusWindow(f);
                f.SelectThread(tid);
            });
            targetThreadButton.Image = Properties.Resources.application_go;
            targetThreadButton.Text = "Find window and select thread";
            targetThreadButton.ToolTipText = "Find window and select thread";
            toolStrip.Items.Add(targetThreadButton);

            try { TerminalServerHandle.RegisterNotificationsCurrent(this, true); }
            catch (Exception ex) { Logging.Log(ex); }
            try { this.UpdateSessions(); }
            catch (Exception ex) { Logging.Log(ex); }

            try { Win32.SetProcessShutdownParameters(0x100, 0); }
            catch { }

            if (Settings.Instance.AppUpdateAutomatic)
                this.UpdateProgram(false);

            ToolStripManager.Renderer = new AeroRenderer(ToolbarTheme.Blue);
        }