📄 sensmon.cs
字号:
namespace Imps.Client.Utils.sensmon
{
using Imps.Client.Utils;
using Imps.Utils;
using System;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
public class sensmon
{
private const string clsid = "E59FA7A1-FF17-40E6-9F10-9A8D9A0D7569";
private const string dll_name = "sensmon.dll";
private static object ms_locker = new object();
public const event_id sens_event_max = event_id.sens_batterylow;
public const event_id sens_event_min = event_id.sens_logon;
public const input_type sens_input_max = input_type.sens_mouse_ll;
public const input_type sens_input_min = input_type.sens_keyboard_ll;
[DllImport("sensmon.dll", EntryPoint="sens_input_simple_subscribe", CallingConvention=CallingConvention.StdCall, ExactSpelling=true)]
public static extern int input_simple_subscribe(input_type id, sens_simple_input_proc_type notify_proc, IntPtr context);
[DllImport("sensmon.dll", EntryPoint="sens_input_simple_unsubscribe", CallingConvention=CallingConvention.StdCall, ExactSpelling=true)]
public static extern int input_simple_unsubscribe(input_type id, sens_simple_input_proc_type notify_proc);
[DllImport("sensmon.dll", EntryPoint="sens_is_fullscreen")]
public static extern bool is_fullscreen(IntPtr hcallerwnd);
public static bool register()
{
return (0 == regsvr32.do_command(Path.Combine(FilePathHelper.AppBaseDir, "sensmon.dll"), "/s"));
}
[DllImport("sensmon.dll", EntryPoint="sens_simple_subscribe", CallingConvention=CallingConvention.StdCall, ExactSpelling=true)]
public static extern int simple_subscribe(event_id id, sens_simple_notify_proc_type notify_proc, IntPtr context);
[DllImport("sensmon.dll", EntryPoint="sens_simple_unsubscribe", CallingConvention=CallingConvention.StdCall, ExactSpelling=true)]
public static extern int simple_unsubscribe(event_id id, sens_simple_notify_proc_type notify_proc);
public static bool try_register()
{
if (!registered)
{
lock (ms_locker)
{
if (!registered)
{
return register();
}
return true;
}
}
return true;
}
public static bool registered
{
get
{
return regsvr32.is_registered("E59FA7A1-FF17-40E6-9F10-9A8D9A0D7569", Path.Combine(FilePathHelper.AppBaseDir, "sensmon.dll"));
}
}
public enum event_id
{
sens_batterylow = 20,
sens_connectionlost = 15,
sens_connectionmade = 13,
sens_connectionmadenoqocinfo = 14,
sens_destinationreachable = 0x10,
sens_destinationreachablenoqocinfo = 0x11,
sens_displaylock = 4,
sens_displayunlock = 5,
sens_logoff = 2,
sens_logoff2 = 9,
sens_logon = 1,
sens_logon2 = 8,
sens_onacpower = 0x12,
sens_onbatterypower = 0x13,
sens_postshell = 12,
sens_sessiondisconnect = 10,
sens_sessionreconnect = 11,
sens_startscreensaver = 6,
sens_startshell = 3,
sens_stopscreensaver = 7
}
public enum input_type
{
sens_keyboard_ll = 1,
sens_mouse_ll = 2
}
public delegate void sens_simple_input_proc_type(Imps.Client.Utils.sensmon.sensmon.input_type id, IntPtr context);
public delegate void sens_simple_notify_proc_type(Imps.Client.Utils.sensmon.sensmon.event_id id, IntPtr context);
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -