模拟右键点击任务管理器的某个进程,再点击菜单中的结束进程
任务管理器显示进程是SysTreeView32,我已经可以定位到某一行,但怎么获得该行的坐标及发送右键弹出菜单及点击指定的菜单命令。
[解决办法]
为何不直接用 TerminateProcess() 终止进程?
[解决办法]
'托盘开始Private Type NOTIFYICONDATA cbSize As Long hwnd As Long uId As Long uFlags As Long ucallbackMessage As Long hIcon As Long szTip As String * 64End TypePrivate t As NOTIFYICONDATAPrivate Const NIM_ADD = &H0Private Const NIM_MODIFY = &H1Private Const NIM_DELETE = &H2Private Const WM_MOUSEMOVE = &H200Private Const WM_LBUTTONUP = &H202Private Const WM_RBUTTONUP = &H205Private Const WM_LBUTTONDBLCLK = &H203Private Const NIF_MESSAGE = &H1Private Const NIF_ICON = &H2Private Const NIF_TIP = &H4Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As BooleanPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single) Dim lmsg As Single lmsg = x / Screen.TwipsPerPixelX' Debug.Print lmsg Select Case lmsg Case WM_LBUTTONUP' "msgbox "请用鼠标右键点击图标!", vbinformation, "实时播音专家"' "单击左键,显示窗体' "下面两句的目的是把窗口显示在窗口最顶层' "me.show' Me.SetFocus Case WM_RBUTTONUP' MsgBox "a" PopupMenu menu_Tools '如果是在系统tray图标上点右键,则弹出菜单menutray' "" case wm_mousemove' "" case wm_lbuttondown Case WM_LBUTTONDBLCLK Me.WindowState = 0 '下面两句的目的是把窗口显示在窗口最顶层 Me.Show Me.SetFocus ' "" case wm_rbuttondown' "" case wm_rbuttondblclk' "" case else End SelectEnd Sub