예제 #1
0
        public HackerWindow()
        {
            InitializeComponent();

            // Force the handle to be created
            { var handle = this.Handle; }
            Program.HackerWindowHandle = this.Handle;

            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 += new EventHandler(thumbButtonManager_TaskbarButtonCreated);
            }

            this.AddEscapeToClose();

            // Initialize action syncs
            _enableNetworkProviderSync = new ActionSync(
                () =>
                {
                    Program.NetworkProvider.Enabled = true;
                    Program.NetworkProvider.Boost();
                }, 2);
            _refreshHighlightingSync = new ActionSync(
                () =>
                {
                    this.BeginInvoke(new Action(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();

            vistaMenu.DelaySetImageCalls = false;
            vistaMenu.PerformPendingSetImageCalls();

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

            _dontCalculate = 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);
        }