Source/Controls/NonClientHook.cs
(开头部分) 8KB这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。
using System;
using System.Windows.Forms;
using System.Collections;
using System.Threading;
using System.Drawing;
using System.Runtime.InteropServices;
namespace DevComponents.DotNetBar
{
/// <summary>
/// Summary description for MessageHandler.
/// </summary>
internal class NonClientHook
{
private static ArrayList m_Clients = new ArrayList();
private static Hashtable m_FilterOnThread = new Hashtable();
private static ReaderWriterLock rwClientsListLock;
private static MouseProc m_MouseHook = null;
private delegate IntPtr MouseProc(int nCode, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr SetWindowsHookEx(int hookid, MouseProc pfnhook, IntPtr hinst, int threadid);
//[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true, EntryPoint = "SetWindowsHookEx")]
//private static extern IntPtr SetWindowsHookExKeyboard(int hookid, KeyboardProc pfnhook, IntPtr hinst, int threadid);
[DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
private static extern bool UnhookWindowsHookEx(IntPtr hhook);
[DllImport("user32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
private static extern IntPtr CallNextHookEx(IntPtr hhook, int code, IntPtr wparam, IntPtr lparam);
[DllImport("kernel32.dll", ExactSpelling = true, CharSet = CharSet.Auto)]
private static extern int GetCurrentThreadId();
private const int WH_MOUSE = 7;
private const int HC_ACTION = 0;
private const int WH_CALLWNDPROCRET = 12;
private const int WH_CALLWNDPROC = 4;
// Methods
static NonClientHook()
{
NonClientHook.rwClientsListLock = new ReaderWriterLock();
m_MouseHook = new MouseProc(OnMouseHook);
}
public static void RegisterHook(ISkinHook client)
{
if (m_Clients.Contains(client))
return;
if (!m_FilterOnThread.ContainsKey(System.Threading.Thread.CurrentThread.GetHashCode()))
HookThread();
LockCookie cookie1 = new LockCookie();
bool readerLockHeld = NonClientHook.rwClientsListLock.IsReaderLockHeld;
if (readerLockHeld)
{
后面还有 188 行代码,解锁后查看完整代码
24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明
AI 解读 AI
登录后可用,每次 10 算力,解读结果公开显示在下面。
还没有人解读过这个文件。