📄 frmsystray.frm
字号:
VERSION 5.00
Begin VB.Form frmSystray
Caption = "Form2"
ClientHeight = 705
ClientLeft = 165
ClientTop = 735
ClientWidth = 2745
Icon = "frmSystray.frx":0000
LinkTopic = "Form2"
ScaleHeight = 705
ScaleWidth = 2745
StartUpPosition = 3 '窗口缺省
Visible = 0 'False
Begin VB.PictureBox picLocked
Height = 615
Left = 1440
Picture = "frmSystray.frx":06EA
ScaleHeight = 555
ScaleWidth = 555
TabIndex = 2
Top = 0
Width = 615
End
Begin VB.Timer tmrSecurity
Interval = 1000
Left = 2280
Top = 0
End
Begin VB.PictureBox picOff
Height = 615
Left = 720
Picture = "frmSystray.frx":0FB4
ScaleHeight = 555
ScaleWidth = 555
TabIndex = 1
Top = 0
Width = 615
End
Begin VB.PictureBox picOn
Height = 615
Left = 0
Picture = "frmSystray.frx":187E
ScaleHeight = 555
ScaleWidth = 555
TabIndex = 0
Top = 0
Width = 615
End
Begin VB.Menu mnuFile
Caption = "文件(&F)"
Begin VB.Menu mnuAbout
Caption = "关于(&A)"
End
Begin VB.Menu mnuOnOff
Caption = "开启"
End
Begin VB.Menu mnuSettings
Caption = "设置"
End
Begin VB.Menu mnuLine1
Caption = "-"
End
Begin VB.Menu mnuExit
Caption = "退出(&E)"
End
End
End
Attribute VB_Name = "frmSystray"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
'Download by http://www.codefans.net
Private Sub Form_Load()
If App.PrevInstance Then End
NotifyIcon.cbSize = Len(NotifyIcon)
NotifyIcon.hwnd = picOn.hwnd
NotifyIcon.uID = 1&
NotifyIcon.uFlags = NIF_MESSAGE Or NIF_ICON Or NIF_TIP
NotifyIcon.uCallbackMessage = WM_MOUSEMOVE
NotifyIcon.hIcon = picOn.Picture
NotifyIcon.szTip = "磁盘锁" & Chr$(0)
Shell_NotifyIcon NIM_ADD, NotifyIcon
appActive = False
doExit = False
doDisable = False
updateGLsettings
'frmMain.Show
End Sub
Private Sub Form_Unload(Cancel As Integer)
Shell_NotifyIcon NIM_DELETE, NotifyIcon
End Sub
Private Sub mnuExit_Click()
doExit = True
frmWarning.checkSecurity
End Sub
Private Sub mnuOnOff_Click()
Select Case (mnuOnOff.Checked)
Case False
frmMain.Visible = True
NotifyIcon.hIcon = picOn.Picture
NotifyIcon.szTip = "磁盘锁已开启" & Chr$(0)
Shell_NotifyIcon NIM_MODIFY, NotifyIcon
Case True
frmMain.Visible = False
NotifyIcon.hIcon = picOff.Picture
NotifyIcon.szTip = "磁盘锁已关闭" & Chr$(0)
Shell_NotifyIcon NIM_MODIFY, NotifyIcon
End Select
mnuOnOff.Checked = Not (mnuOnOff.Checked)
End Sub
Private Sub mnuSettings_Click()
frmOptions.Show
End Sub
Private Sub picOn_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
If Hex(x) = "1E3C" Then frmSystray.PopupMenu frmSystray.mnuFile
If Hex(x) = "1E0F" Then frmMain.Show
End Sub
Private Sub tmrSecurity_Timer()
If Not appActive Then
tmrSecurity.Enabled = False
Exit Sub
End If
DoEvents
glSecondsUsed = glSecondsUsed + 1
If glSecondsUsed > 59 Then
glSecondsUsed = 0
glMinutesUsed = glMinutesUsed + 1
End If
If glMinutesUsed > 59 Then
glMinutesUsed = 0
glHoursUsed = glHoursUsed + 1
End If
If glSecondsUsed >= glSeconds And glMinutesUsed >= glMinutes And glHoursUsed >= glHours Then
glSecondsUsed = 0
glMinutesUsed = 0
glHoursUsed = 0
appActive = False
frmWarning.checkSecurity
End If
End Sub
Public Sub closeSystray()
Shell_NotifyIcon NIM_DELETE, NotifyIcon
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -