public static void Initialize(GameWindow window) { if (created) { throw new InvalidOperationException("WinHook Can Only Initialize Once"); } created = true; hookProcDelegate = HookProc; prevWndProc = (IntPtr)SetWindowLong(window.Handle, GWL_WNDPROC, (int)Marshal.GetFunctionPointerForDelegate(hookProcDelegate)); hIMC = ImmGetContext(window.Handle); MouseEventDispatcher.SetToHook(); }