如何把VB程序最小化到托盘图标区

请问怎么把一个VB程序最小货到托盘图标区... 请问怎么把一个VB程序最小货到托盘图标区 展开
 我来答
whlibk
2006-12-16 · 超过31用户采纳过TA的回答
知道答主
回答量:130
采纳率:0%
帮助的人:88.5万
展开全部
托盘添加ICO
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_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim lMsg As Single
lMsg = X / Screen.TwipsPerPixelX
If lMsg = WM_RBUTTONUP Or lMsg = WM_LBUTTONUP Then Me.PopupMenu sys
End Sub

Private Sub command1_Click()
nfIconData.hwnd = Me.hwnd
nfIconData.uID = Me.Icon
nfIconData.uFlags = NIF_ICON Or NIF_MESSAGE Or NIF_TIP
nfIconData.uCallbackMessage = WM_MOUSEMOVE
nfIconData.hIcon = Me.Icon.Handle
nfIconData.szTip = "System Tray Example" & vbNullChar
nfIconData.cbSize = Len(nfIconData)
Call Shell_NotifyIcon(NIM_ADD, nfIconData)
End Sub

Private Sub command1_Click()
Call Shell_NotifyIcon(NIM_DELETE, nfIconData)
End Sub

Private Sub command2_Click()
ShowWindow Me.hwnd, SW_HIDE
End Sub

Private Sub Command3_Click()
Me.Visible = False
End Sub

Private Sub move_Click()
Call Shell_NotifyIcon(NIM_DELETE, nfIconData)
End Sub

Private Sub show_Click()
Me.Visible = True
End Sub
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
百度网友dc91b32
2006-12-12 · TA获得超过5650个赞
知道大有可为答主
回答量:5653
采纳率:0%
帮助的人:0
展开全部
建议下载一个ocx控件,我用过的,可以实现
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
dl_会飞的青蛙
2006-12-12 · TA获得超过2456个赞
知道大有可为答主
回答量:3294
采纳率:0%
帮助的人:3392万

参考资料: vb吧

本回答被提问者采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式