如何用VB在后台运行

谁能告诉我怎么让VB做的程序在后台运行就是像QQ那样最小化到后台就是最小化后只在任务栏的时间旁显示像QQ和音量控制那样... 谁能告诉我怎么让VB做的程序在后台运行
就是像QQ那样最小化到后台
就是最小化后只在任务栏的时间旁显示像QQ和音量控制那样
展开
 我来答
hua505335849
2009-08-07 · TA获得超过173个赞
知道答主
回答量:496
采纳率:0%
帮助的人:163万
展开全部
'菜单编辑器
'名称: Traymenu, 标题: 主菜单
'名称: menuexit, 标题: 退出
'然后把代码复制进去

Option Explicit
Const MAX_TOOLTIP As Integer = 64
Const NIF_ICON = &H2
Const NIF_MESSAGE = &H1
Const NIF_TIP = &H4
Const NIM_ADD = &H0
Const NIM_DELETE = &H2
Const WM_MOUSEMOVE = &H200
Const WM_LBUTTONDOWN = &H201
Const WM_LBUTTONUP = &H202
Const WM_LBUTTONDBLCLK = &H203
Const WM_RBUTTONDOWN = &H204
Const WM_RBUTTONUP = &H205
Const WM_RBUTTONDBLCLK = &H206
Const SW_RESTORE = 9
Const SW_HIDE = 0
Private Type NOTIFYICONDATA
cbSize As Long
hwnd As Long
uID As Long
uFlags As Long
uCallbackMessage As Long
hIcon As Long
szTip As String * MAX_TOOLTIP
End Type
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long
Private Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
Private nfIconData As NOTIFYICONDATA

Private Sub Form_Unload(Cancel As Integer)
Cancel = 1
nfIconData.cbSize = Len(nfIconData)
nfIconData.uID = vbNull
nfIconData.hwnd = Me.hwnd
nfIconData.uFlags = NIF_TIP Or NIF_MESSAGE Or NIF_ICON
nfIconData.uCallbackMessage = WM_MOUSEMOVE
nfIconData.hIcon = Me.Icon
nfIconData.szTip = "测试" & vbNullChar
Shell_NotifyIcon NIM_ADD, nfIconData
Me.Hide
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim lMsg As Single
lMsg = X / Screen.TwipsPerPixelX
If lMsg = WM_LBUTTONUP Then
Me.WindowState = 0
Me.Show
Else
If lMsg = WM_RBUTTONUP Then
PopupMenu Traymenu
End If
End If
End Sub

Private Sub menuexit_Click()
End
End Sub
不需要的东西自己改
guanguanwky
2009-08-07 · TA获得超过237个赞
知道小有建树答主
回答量:379
采纳率:0%
帮助的人:315万
展开全部
me.visible = false就行了吧。
不满意就再加个系统托盘
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
Li_Zaodie
2009-08-07 · TA获得超过648个赞
知道小有建树答主
回答量:529
采纳率:0%
帮助的人:394万
展开全部
APP.TASKVISIABLE = FALSE
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式