コード例 #1
0
ファイル: Program.cs プロジェクト: volthouse/desktop
        void handleProcessComboSelectedIndexChanged(object sender, EventArgs e)
        {
            this.notifyIcon.ContextMenuStrip.Hide();
            var combo = (ToolStripComboBox)sender;
            this.processWrapper = (ProcessWrapper)combo.SelectedItem;
            if (this.processWrapper.Windowname.Length > 64) {
                this.notifyIcon.Text = this.processWrapper.Windowname.Substring(1, 63);
            } else {
                this.notifyIcon.Text = this.processWrapper.Windowname;
            }
            combo = null;

            this.processWrapper.ToggleTaskbarButton();

            setIcon(true);
            this.trackBarHost.Visible = true;
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: volthouse/desktop
 private void populateCombo(ToolStripComboBox combo)
 {
     combo.Items.Clear();
     foreach (var p in System.Diagnostics.Process.GetProcesses()) {
         if (p.MainWindowTitle == string.Empty) {
             continue;
         }
         var pw = new ProcessWrapper()
         {
             Handle = p.MainWindowHandle,
             Windowname = p.MainWindowTitle
         };
         combo.Items.Add(pw);
     }
 }
コード例 #3
0
ファイル: Program.cs プロジェクト: volthouse/desktop
        public ToTryHandler(IntPtr handle)
        {
            this.notifyIcon = new NotifyIcon();
            this.notifyIcon.Icon = Properties.Resources.Icon;
            this.notifyIcon.ContextMenuStrip = new ContextMenuStrip();
            this.notifyIcon.ContextMenuStrip.ShowCheckMargin = false;
            this.notifyIcon.ContextMenuStrip.ShowImageMargin = false;
            this.notifyIcon.Visible = true;
            this.notifyIcon.MouseClick += handleNotifyIconMouseClick;
            this.notifyIcon.DoubleClick += handleNotifyIconDoubleClick;

            this.localWindowsHook = new LocalWindowsHook(HookType.WH_KEYBOARD_LL);
            this.localWindowsHook.HookInvoked += handleHookInvoked;
            this.localWindowsHook.Install();

            populateContextMenu();

            if (!(handle == IntPtr.Zero)) {
                this.processWrapper = new ProcessWrapper();
                this.processWrapper.Handle = handle;
                this.processWrapper.ToggleTaskbarButton();
                this.processWrapper.ToggleVisibility();
                setIcon(true);
                this.trackBarHost.Visible = true;
            }
        }