如何在自己编的VB程序里加入隐藏到系统托盘的功能??
如何在自己编的VB程序里加入隐藏到系统托盘的功能??最小化后右下角系统托盘。还有开机自启动功能开机自启动后隐藏到系统托盘还要加两个复选框后面是开机自启动和最小化后隐藏到系...
如何在自己编的VB程序里加入隐藏到系统托盘的功能??最小化后右下角系统托盘。
还有开机自启动功能 开机自启动后 隐藏到系统托盘
还要加两个复选框 后面是 开机自启动 和 最小化后隐藏到系统托盘 打钩就启用相应的功能
需要加入什么代码?请高手麻烦把代码写出来! 感激不尽!!! 展开
需要加入什么代码?请高手麻烦把代码写出来! 感激不尽!!! 展开
2个回答
展开全部
新建立一标准exe程序,在form1中添加一command按钮,然后把下在的代码复制过去就可以解决!解决了乱码的问题,XP+VB6测试通过!
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
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 NOTIFYICONDATA
Private Sub Command1_Click()
tray.cbSize = Len(tray)
tray.uId = vbNull
tray.hWnd = Me.hWnd
tray.uFlags = NIF_TIP Or NIF_MESSAGE Or NIF_ICON
tray.uCallBackMessage = WM_MOUSEMOVE
tray.hIcon = Me.Icon
tray.szTip = "测试" & vbNullChar
Shell_NotifyIcon NIM_ADD, tray
Me.Hide
End Sub
Private 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
Me.Show
Shell_NotifyIcon NIM_DELETE, tray
End If
End Sub
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
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 NOTIFYICONDATA
Private Sub Command1_Click()
tray.cbSize = Len(tray)
tray.uId = vbNull
tray.hWnd = Me.hWnd
tray.uFlags = NIF_TIP Or NIF_MESSAGE Or NIF_ICON
tray.uCallBackMessage = WM_MOUSEMOVE
tray.hIcon = Me.Icon
tray.szTip = "测试" & vbNullChar
Shell_NotifyIcon NIM_ADD, tray
Me.Hide
End Sub
Private 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
Me.Show
Shell_NotifyIcon NIM_DELETE, tray
End If
End Sub
参考资料: http://zhidao.baidu.com/question/52729529.html?fr=ala0
展开全部
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询