Exemplo n.º 1
0
 private MainThread()
 {
     WinImports.EnumWindows(WindowProc, IntPtr.Zero);
     _newCallback = WndProc; // Pins WndProc - will not be garbage collected.
     _oldCallback = WinImports.SetWindowLong((IntPtr)_hWnd, GWL_WNDPROC,
                                             Marshal.GetFunctionPointerForDelegate(_newCallback));
     mtId = Process.GetCurrentProcess().Threads[0].Id;
 }
Exemplo n.º 2
0
 public static void Init()
 {
     if (Applied)
     {
         return;
     }
     WinImports.EnumWindows(WindowProc, IntPtr.Zero);
     _newCallback = WndProc; // Pins WndProc - will not be garbage collected.
     _oldCallback = WinImports.SetWindowLong(HWnD, GWL_WNDPROC,
                                             Marshal.GetFunctionPointerForDelegate(_newCallback));
     Applied = true;
 }