我写了一个托盘程序,当右击时弹出快捷菜单,但是怎么样当在屏幕上其它地方点击一下时,怎么把菜单消失,谢谢~
解决方案 »
- 在http://reg.163.com/reg/reg0.jsp?url=http://mscan.163.com/QuickCreateMail.jsp页面中,如何是焦点落在输入验证码的框中
- VB有做视频分割的控件或api吗?
- 200分求解!向CPU卡发送一条指令后如何得到返回的状态码?
- 我要为软件做一个ftp升级程序。谁有好一点的FTP控件,并且有下载FTP目录里所有文件的源代码?高分索求,不胜感谢!
- 无知到现在这种地步了!
- 【绿豆结婚】散分恭喜!!!
- treeview里的node的key有长度限制吗?
- 用installshield打包vb程序提示:"dll找不到指定程序"
- 如何
- 高手帮忙,给下面程序提建议,任何建议,只要是你觉得能改善的(给我所有分)
- 想问下
- 如何在vb中对rpt文件操作
Private Sub tmrSystem_Timer()
Dim intKey As Integer
Dim intMouse As Integer
Dim strClassName As String * 255
Dim hwnd1 As Long
Dim Mousemsg As POINTAPI
intMouse = (GetAsyncKeyState(VK_LBUTTON) And &HFF00) / 2 ^ 15
If intKey = -1 Then 'F12
frmMain.WindowState = frmMain.LastState
frmMain.Visible = True
frmMain.SetFocus
End If
If intMouse = -1 And frmMain.WindowState = 1 Then 'LBUTTON
GetCursorPos Mousemsg
Call GetClassName(WindowFromPoint(Mousemsg.X, Mousemsg.Y), strClassName, 255)
If (InStr(strClassName, "#32768")) < 1 Then
hwnd1 = FindWindow("#32768", "")
Dim rt As RECT
If hwnd1 > 0 Then
GetWindowRect hwnd1, rt
If rt.Left > Screen.Width / Screen.TwipsPerPixelX - 300 And rt.Top > Screen.Height / Screen.TwipsPerPixelY - 150 Then
SendMessage hwnd1, &H10, 0, 0 '关闭右键菜单
End If
End If
End If
End If
endif
GetForegroundWindow VB声明
Declare Function GetForegroundWindow Lib "user32" Alias "GetForegroundWindow" () As Long
说明
获得前台窗口的句柄。这里的“前台窗口”是指前台应用程序的活动窗口
返回值
Long,前台窗口的句柄
注解
windows nt支持多个桌面,它们相互间是独立的。每个桌面都有自己的前台窗口
SetForegroundWindow Me.hwnd '关键是这个函数,加上它之后,弹出菜单就会消失!!