Exemplo n.º 1
0
        private void lstWindow_MouseUp(object sender, MouseEventArgs e)
        {
            MiyukiListBox lst = (MiyukiListBox)lstWindow;

            if (lst.HoverIndex == -1)
            {
                return;
            }

            lst.SelectedIndex = lst.HoverIndex;

            if (e.Button == MouseButtons.Right)
            {
                thisItem = WindowList[lst.HoverIndex];

                menuItemProcessName.Text = "Handle: " + thisItem.Handle.ToString();
                menuItemWindowName.Text  = thisItem.ProcessFileName != "" ? "Process: " + thisItem.ProcessFileName : "No process information";

                if (this.thisItem.Handle == IntPtr.Zero)
                {
                    menuItemWindowTopMost.Enabled = menuItemCancelTopmost.Enabled = false;
                }
                else
                {
                    bool isTopMost = WinAPI.isWindowTopMost(this.thisItem.Handle);
                    menuItemWindowTopMost.Enabled = !isTopMost;
                    menuItemCancelTopmost.Enabled = isTopMost;
                }

                menuItemOpenLocation.Enabled = thisItem.ProcessFileName != "";

                // set checked state with current opacity
                byte opacity = thisItem.WindowOpacity;
                menuItemSetOpacityTo100.Checked = thisItem.CanSetWindowOpacity && (opacity == 255);
                menuItemSetOpacityTo90.Checked  = thisItem.CanSetWindowOpacity && (opacity == 229);
                menuItemSetOpacityTo75.Checked  = thisItem.CanSetWindowOpacity && (opacity == 191);
                menuItemSetOpacityTo50.Checked  = thisItem.CanSetWindowOpacity && (opacity == 127);
                menuItemSetOpacityTo25.Checked  = thisItem.CanSetWindowOpacity && (opacity == 63);
                menuItemSetOpacityTo0.Checked   = thisItem.CanSetWindowOpacity && (opacity == 0);
                //menuItemSetOpacity.Enabled = thisItem.CanSetWindowOpacity;

                contextMenu.Show(this, e.Location);
            }
        }
Exemplo n.º 2
0
        private void menuGetInfo_Click(object sender, EventArgs e)
        {
            MiyukiListBox lst = (MiyukiListBox)lstWindow;

            if (lst.HoverIndex == -1)
            {
                return;
            }

            thisItem = WindowList[lst.HoverIndex];

            string info = "窗口句柄: " + thisItem.Handle.ToString() + "\r\n";

            info += "窗口名称:" + thisItem.WindowName + "\r\n";
            info += thisItem.ProcessFileName != "" ? "进程名: " + thisItem.ProcessFileName : "无法获取到进程信息,请使用管理员权限运行本程序后再试。";
            info += "\r\n";
            info += "进程位置:" + thisItem.ProcessFullPath + "\r\n";
            //info += "进程物理位置:" + thisItem.ProcessFullPath + "\r\n";

            MessageBox.Show(info, !String.IsNullOrEmpty(thisItem.WindowName) ? thisItem.WindowName : thisItem.Description, MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
 public MiyukiListBoxItemCollection(MiyukiListBox onwer)
 {
     this.m_onwer = onwer;
 }