vb 窗口最小化到系统托盘的问题

怎样在点击按钮后将窗口显示在系统托盘中?这样操作后鼠标放到该程序在系统托盘上的图标后显示的文字是乱码,这是怎么回事?不是已经写了nid.szTip=App.Title+"... 怎样在点击按钮后将窗口显示在系统托盘中?

这样操作后 鼠标放到该程序在系统托盘上的图标后显示的文字是乱码,这是怎么回事?
不是已经写了nid.szTip = App.Title + "(版本 V1.0)" & vbNullChar吗?
展开
 我来答
PAL神仙
2008-05-03 · TA获得超过461个赞
知道小有建树答主
回答量:229
采纳率:0%
帮助的人:232万
展开全部
新建立一标准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
♂莣鋽鐹佉♀
2008-05-03
知道答主
回答量:1
采纳率:0%
帮助的人:0
展开全部
新建Form1:
Private Sub Command1_Click()
nid.cbSize = Len(nid)
nid.uId = vbNull
nid.hWnd = Me.hWnd
nid.uFlags = NIF_TIP Or NIF_MESSAGE Or NIF_ICON
nid.uCallBackMessage = WM_MOUSEMOVE
nid.hIcon = Me.Icon
nid.szTip = App.Title + "(版本 V1.0)" & vbNullChar
Shell_NotifyIcon NIM_ADD, nid
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, nid
End If
End Sub

新建模块:
Public Declare Function Shell_NotifyIcon Lib "shell32.dll" (ByVal dwMessage As Long, lpData As NOTIFYICONDATA) As Long

Public Const NIM_ADD = &H0
Public Const NIM_DELETE = &H2
Public Const NIF_ICON = &H2
Public Const NIF_MESSAGE = &H1
Public Const NIF_TIP = &H4
Public Const WM_MOUSEMOVE = &H200
Public Const WM_LBUTTONDBLCLK = &H203

Public Type NOTIFYICONDATA
cbSize As Long
hWnd As Long
uId As Long
uFlags As Long
uCallBackMessage As Long
hIcon As Long
szTip As String
End Type
Public nid As NOTIFYICONDATA
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

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

类别

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

说明

0/200

提交
取消

辅 助

模 式