vb中如何实现程序启动后只将图标显示在任务栏上

vb中如何实现程序启动后只将图标显示在任务栏上,当鼠标移动到任务栏图标上时才显示窗体界面(就像运行云端时那样)... vb中如何实现程序启动后只将图标显示在任务栏上,当鼠标移动到任务栏图标上时才显示窗体界面(就像运行云端时那样) 展开
 我来答
chunhuanfjdk
2011-06-10 · 超过29用户采纳过TA的回答
知道答主
回答量:132
采纳率:0%
帮助的人:97.1万
展开全部
下面代码是我花了很长时间编写出来的,绝对可以用。

Private Declare Function Shell_NotifyIcon Lib "shell32.dll" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long
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
Private Const NIM_ADD = &H0
Private Const NIM_MODIFY = &H1
Private Const NIM_DELETE = &H2
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4
Private Const WM_MOUSEMOVE = &H200
Private Const WM_LBUTTONDBLCLK = &H203
Private Const WM_LBUTTONDOWN = &H201
Private Const WM_LBUTTONUP = &H202
Private Const WM_RBUTTONDBLCLK = &H206
Private Const WM_RBUTTONDOWN = &H204
Private Const WM_RBUTTONUP = &H205
Dim Nid As NOTIFYICONDATA

Private Sub Form_Load()
If App.PrevInstance Then Unload Me
Nid.cbSize = Len(Nid)
Nid.hwnd = hwnd
Nid.uID = vbNull
Nid.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
Nid.uCallbackMessage = WM_MOUSEMOVE
Nid.hIcon = Form1.Icon
Nid.szTip = "托盘图标演示" & vbNullChar
Shell_NotifyIcon NIM_ADD, Nid
End Sub

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
Dim msg As Single
On Error Resume Next
msg = X / Screen.TwipsPerPixelX
Select Case msg
Case WM_RBUTTONDOWN
Case WM_RBUTTONUP
PopupMenu popMenu
Case WM_LBUTTONDBLCLK
Form1.Show
End Select
End Sub

Private Sub Form_Unload(Cancel As Integer)
Shell_NotifyIcon NIM_DELETE, Nid
End Sub

Private Sub mnuExit_Click()
Unload Me
End Sub

Private Sub mnuHide_Click()
Form1.Hide
End Sub

Private Sub mnuShow_Click()
Form1.Show
End Sub
匿名用户
2011-06-10
展开全部
Aero特效么?还是简单的托盘?
追问
不是托盘 就是程序启动时在任务栏 左 侧显示程序的图标(不是最小化在任务栏在任务栏上得到的图标,如win7中将qq锁定在任务栏上显示的那种)
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 1条折叠回答
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式