你试试下面的代码。。'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''托盘 Public Const NIM_ADD = 0 Public Const NIM_MODIFY = 1 Public Const NIM_DELETE = 2 Public Const NIF_MESSAGE = 1 Public Const NIF_ICON = 2 Public Const NIF_TIP = 4 Public Const WM_MOUSEMOVE = &H200 Public Const WM_LBUTTONDOWN = &H201 '左键按下 Public Const WM_LBUTTONUP = &H202 '左键抬起 Public Const WM_LBUTTONDBLCLK = &H203 '左键双击 Public Const WM_RBUTTONDOWN = &H204 '右键按下 Public Const WM_RBUTTONUP = &H205 '右键抬起 Public Const WM_RBUTTONDBLCLK = &H206 '右键双击 Public Const WM_MBUTTONDOWN = &H207 '中键按下 Public Const WM_MBUTTONUP = &H208 '中键抬起 Public Const WM_MBUTTONDBLCLK = &H209 '中键双击Public Type NotifyIconData '托盘 cbSize As Long Hwnd As Long 'Handle of the window that receives notification messages uID As Long 'App-defined identifier of the taskbar icon uFlags As Long 'Flags uCallbackMessage As Long 'App-defined message identifier hIcon As Long 'Handle to an icon(一个图标的句柄) szTip As String * 64 'Tool text display message End Type '设置系统托盘 Public Declare Function Shell_NotifyIconA Lib "shell32" (ByVal dwMessage As Long, lpData As NotifyIconData) As Integer Private Sub Form_Load() Dim tNID As NotifyIconData
Me.Hide
'加载托盘图标 tNID.cbSize = Len(tNID) tNID.Hwnd = Me.Hwnd tNID.uID = vbNull tNID.uCallbackMessage = WM_MOUSEMOVE 'This is necesary for catch the mousemove event with our form tNID.hIcon = imgIcon.Picture tNID.szTip = "八阁软件 : Export v" & App.Major & "." & App.Minor & "." & App.Revision & Chr$(0) tNID.uFlags = NIF_ICON Or NIF_MESSAGE Or NIF_TIP Call Shell_NotifyIconA(NIM_ADD, tNID)
Public Const NIM_ADD = 0
Public Const NIM_MODIFY = 1
Public Const NIM_DELETE = 2
Public Const NIF_MESSAGE = 1
Public Const NIF_ICON = 2
Public Const NIF_TIP = 4
Public Const WM_MOUSEMOVE = &H200
Public Const WM_LBUTTONDOWN = &H201 '左键按下
Public Const WM_LBUTTONUP = &H202 '左键抬起
Public Const WM_LBUTTONDBLCLK = &H203 '左键双击
Public Const WM_RBUTTONDOWN = &H204 '右键按下
Public Const WM_RBUTTONUP = &H205 '右键抬起
Public Const WM_RBUTTONDBLCLK = &H206 '右键双击
Public Const WM_MBUTTONDOWN = &H207 '中键按下
Public Const WM_MBUTTONUP = &H208 '中键抬起
Public Const WM_MBUTTONDBLCLK = &H209 '中键双击Public Type NotifyIconData '托盘
cbSize As Long
Hwnd As Long 'Handle of the window that receives notification messages
uID As Long 'App-defined identifier of the taskbar icon
uFlags As Long 'Flags
uCallbackMessage As Long 'App-defined message identifier
hIcon As Long 'Handle to an icon(一个图标的句柄)
szTip As String * 64 'Tool text display message
End Type
'设置系统托盘
Public Declare Function Shell_NotifyIconA Lib "shell32" (ByVal dwMessage As Long, lpData As NotifyIconData) As Integer
Private Sub Form_Load()
Dim tNID As NotifyIconData
Me.Hide
'加载托盘图标
tNID.cbSize = Len(tNID)
tNID.Hwnd = Me.Hwnd
tNID.uID = vbNull
tNID.uCallbackMessage = WM_MOUSEMOVE 'This is necesary for catch the mousemove event with our form
tNID.hIcon = imgIcon.Picture
tNID.szTip = "八阁软件 : Export v" & App.Major & "." & App.Minor & "." & App.Revision & Chr$(0)
tNID.uFlags = NIF_ICON Or NIF_MESSAGE Or NIF_TIP
Call Shell_NotifyIconA(NIM_ADD, tNID)
'Load frmMain '打开主窗口
End Sub