📄 systray.bas
字号:
Attribute VB_Name = "module4"
'Module: SysTray.BAS
' To put an icon in system tray
'Author: Pheeraphat Sawangphian
'E-Mail: tooh@thaimail.com
'URL: http://www.geocities.com/Hollywood/Lot/6166
'Note: Put the following lines in Form Load event.
' SystemTray.cbSize = Len(SystemTray)
' SystemTray.hWnd = Me.hWnd
' SystemTray.uId = vbNull
' SystemTray.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
' SystemTray.ucallbackMessage = WM_MOUSEMOVE
' SystemTray.hIcon = <Icon>
' SystemTray.szTip = <Tip> & vbNullChar
' Call Shell_NotifyIcon(NIM_ADD, SystemTray)
' Where <Icon> is an icon you want to show in system tray.
' <Tip> is a tip that shown when mouse moved over the icon in system tray
' You can detect mouse event in Form MouseMove event.
' To remove an icon from system tray:
' Call Shell_NotifyIcon(NIM_DELETE, SystemTray)
Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
Public Const NIM_ADD = &H0 'add an icon into system tray
Public Const NIM_MODIFY = &H1 'update an icon in system tray
Public Const NIM_DELETE = &H2 'remove an icon from system tray
Public Const NIF_MESSAGE = &H1 'return messages
Public Const NIF_ICON = &H2 'adding an icon
Public Const NIF_TIP = &H4 'adding a tip
'constant need for the callback
Public Const WM_LBUTTONDBLCLK = &H203
Public Const WM_RBUTTONUP = &H205
Public Const WM_MOUSEMOVE = &H200
'system tray notification definitions
Public 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
Public SystemTray As NOTIFYICONDATA
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -