📄 tbicon.frm
字号:
VERSION 5.00
Begin VB.Form Form1
Caption = "Form1"
ClientHeight = 1335
ClientLeft = 2160
ClientTop = 1935
ClientWidth = 2700
Icon = "TBIcon.frx":0000
LinkTopic = "Form1"
PaletteMode = 1 'UseZOrder
ScaleHeight = 1335
ScaleWidth = 2700
ShowInTaskbar = 0 'False
Visible = 0 'False
Begin VB.Timer Timer1
Enabled = 0 'False
Interval = 100
Left = 1860
Top = 540
End
Begin VB.PictureBox Picture1
Appearance = 0 'Flat
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 510
Index = 1
Left = 600
Picture = "TBIcon.frx":0442
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 1
Top = 480
Width = 510
End
Begin VB.PictureBox Picture1
Appearance = 0 'Flat
AutoRedraw = -1 'True
AutoSize = -1 'True
BackColor = &H80000005&
ForeColor = &H80000008&
Height = 510
Index = 0
Left = 60
Picture = "TBIcon.frx":0884
ScaleHeight = 480
ScaleWidth = 480
TabIndex = 0
Top = 480
Width = 510
End
Begin VB.Menu xx
Caption = "PopupMenu"
Begin VB.Menu Menu
Caption = "Quit"
Index = 0
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Option Explicit
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 WM_MOUSEMOVE = &H200
Private Const NIF_MESSAGE = &H1
Private Const NIF_ICON = &H2
Private Const NIF_TIP = &H4
Private Declare Function Shell_NotifyIcon Lib "shell32" Alias "Shell_NotifyIconA" (ByVal dwMessage As Long, pnid As NOTIFYICONDATA) As Boolean
Dim t As NOTIFYICONDATA
Private Sub Form_Load()
t.cbSize = Len(t)
t.hWnd = Picture1(0).hWnd
t.uId = 1&
t.uFlags = NIF_ICON Or NIF_TIP Or NIF_MESSAGE
t.ucallbackMessage = WM_MOUSEMOVE
t.hIcon = Picture1(0).Picture
t.szTip = "Shell_NotifyIcon ..." & Chr$(0)
Shell_NotifyIcon NIM_ADD, t
Timer1.Enabled = True
Me.Hide
App.TaskVisible = False
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode As Integer)
Timer1.Enabled = False
t.cbSize = Len(t)
t.hWnd = Picture1(0).hWnd
t.uId = 1&
Shell_NotifyIcon NIM_DELETE, t
End Sub
Private Sub Menu_Click(Index As Integer)
Unload Me
End Sub
Private Sub picture1_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)
If Hex(X) = "1E3C" Then
Me.PopupMenu xx
End If
End Sub
Private Sub timer1_Timer()
Static i As Long, img As Long
t.cbSize = Len(t)
t.hWnd = Picture1(0).hWnd
t.uId = 1&
t.uFlags = NIF_ICON
t.hIcon = Picture1(i).Picture
Shell_NotifyIcon NIM_MODIFY, t
Timer1.Enabled = True
i = i + 1
If i = 2 Then i = 0
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -