📄 tst.frm
字号:
VERSION 5.00
Begin VB.Form Form1
BorderStyle = 0 'None
Caption = "Form1"
ClientHeight = 90
ClientLeft = 0
ClientTop = 0
ClientWidth = 90
LinkTopic = "Form1"
ScaleHeight = 90
ScaleWidth = 90
ShowInTaskbar = 0 'False
StartUpPosition = 3 '窗口缺省
End
Attribute VB_Name = "Form1"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False
Private Declare Function SHChangeNotifyRegister Lib "shell32" Alias "#2" (ByVal hwnd As Long, ByVal uFlags As SHCN_ItemFlags, ByVal dwEventID As SHCN_EventIDs, ByVal uMsg As Long, ByVal cItems As Long, lpps As PIDLSTRUCT) As Long
Private Declare Function SHChangeNotifyDeregister Lib "shell32" Alias "#4" (ByVal hNotify As Long) As Boolean
Private Sub Form_Load()
Dim pcmd As String
pcmd = Command
'MsgBox pcmd
If pcmd = "" Then MsgBox "无法运行", 16: End
Dim Tval As Integer
If Left(pcmd, 1) = "a" Then Tval = 36
mainHwnd = Right(pcmd, Len(pcmd) - 1)
'MsgBox mainHwnd
'---------------
If SubClass(Form1.hwnd) Then '改变Form1的消息处理函数
'If IsIDE Then
Call SHNotify_Register(Form1.hwnd, Tval)
'Else
'MsgBox "监控设置失败! -" & Tval, 16
'End If
End If
'---------------
Me.Hide
End Sub
'Private Function IsIDE() As Boolean
' On Error GoTo Out
' Debug.Print 1 / 0
'Out:
' IsIDE = Err
'End Function
Private Sub Form_Unload(Cancel As Integer)
Call SHNotify_Unregister
Call UnSubClass(hwnd)
End Sub
Public Sub NotificationReceipt(wParam As Long, lParam As Long)
Dim shns As SHNOTIFYSTRUCT
Dim sDisplayname1 As String
Dim sDisplayname2 As String
MoveMemory shns, ByVal wParam, Len(shns)
If shns.dwItem1 Then
sDisplayname1 = GetDisplayNameFromPIDL(shns.dwItem1)
End If
If shns.dwItem2 Then
sDisplayname2 = GetDisplayNameFromPIDL(shns.dwItem2)
End If
sOut = SHNotify_GetEventStr(pfoldp & "\" & sDisplayname1, pfoldp & "\" & sDisplayname2, lParam) & vbCrLf
'MsgBox CLng(VarPtr(sOut))
'PostMessage mainHwnd, &H404, GetCurrentProcessId, VarPtr(sOut)
'Text1 = Text1 & pfoldp & sOut & vbCrLf
'Text1.SelStart = Len(Text1)
End Sub
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -