📄 notify.vb
字号:
Imports System.Runtime.InteropServices
Public Class Notify
' Methods
Public Shared Sub RegisterNamedEvent(ByVal whichEvent As NotificationEvent, ByVal eventName As String)
NativeMethods.CeRunAppAtEvent(("\\.\Notifications\NamedEvents\" & eventName), whichEvent)
End Sub
Public Shared Sub UnregisterNamedEvent(ByVal eventName As String)
NativeMethods.CeRunAppAtEvent(("\\.\Notifications\NamedEvents\" & eventName), NotificationEvent.None)
End Sub
End Class
Public Enum NotificationEvent
None = 0
TimeChange = 1
SyncEnd = 2
OnACPower = 3
OffACPower = 4
NetConnect = 5
NetDisconnect = 6
DeviceChange = 7
IrDiscovered = 8
RS232Detected = 9
RestoreEnd = 10
Wakeup = 11
TZChange = 12
MachineNameChange = 13
End Enum
Friend Class NativeMethods
<DllImport("coredll")> _
Friend Shared Function CeRunAppAtEvent(ByVal pwszAppName As String, ByVal lWhichEvent As NotificationEvent) As Boolean
End Function
Friend Const EventPrefix As String = "\\.\Notifications\NamedEvents\"
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -