用VB设计一个命令按钮,点击后让程序转到后台并在任务栏显示小图标该输入什么?

 我来答
匿名用户
2013-09-20
展开全部
新建一个按钮后输入Private Declare Function Shell_NotifyIcon Lib "shell32.dll" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
Const NIM_ADD = &H0
Const NIM_DELETE = &H2
Const NIF_ICON = &H2
Const NIF_MESSAGE = &H1
Const NIF_TIP = &H4
Const WM_MOUSEMOVE = &H200
Const WM_LBUTTONDBLCLK = &H203
Const WM_RBUTTONDBLCLK = &H206
Const WM_RBUTTONUP = &H205
Private Type NOTIFYICONDATA
cbSize As Long
hwnd As Long
uId As Long
uFlags As Long
uCallBackMessage As Long
hIcon As Long
szTip As String * 64
End Type
Dim tray As NOTIFYICONDATAPrivate Sub Command1_Click()
App.TaskVisible = False
tray.cbSize = Len(tray)
tray.uId = vbNull
tray.hwnd = Form1.hwnd
tray.uFlags = NIF_TIP Or NIF_MESSAGE Or NIF_ICON
tray.uCallBackMessage = WM_MOUSEMOVE
tray.hIcon = Form1.Icon
Shell_NotifyIcon NIM_ADD, tray
Form1.Hide
End SubPrivate Sub Form_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
Dim msg As Long
msg = x / 15
If msg = WM_LBUTTONDBLCLK Then
App.TaskVisible = True
Form1.WindowState = 0
Form1.Show
Shell_NotifyIcon NIM_DELETE, tray
End If
End Sub
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式