示例#1
0
        /// <summary>
        /// Tells Windows to inform our game whenever the window is resized.
        /// </summary>
        private static void SetupResizeHook()
        {
            // Setup hook for when the game window is moved, resized, changes shape...
            WindowEventDelegate += WindowEventDelegateImpl;
            WindowEventHooks.SetWinEventHook
            (
                WindowEventHooks.EVENT_OBJECT_LOCATIONCHANGE,       // Minimum event code to capture
                WindowEventHooks.EVENT_OBJECT_LOCATIONCHANGE,       // Maximum event code to capture
                IntPtr.Zero,                                        // DLL Handle (none required)
                WindowEventDelegate,                                // Pointer to the hook function. (Delegate in our case)
                0,                                                  // Process ID (0 = all)
                0,                                                  // Thread ID (0 = all)
                WindowEventHooks.WINEVENT_OUTOFCONTEXT              // Flags: Allow cross-process event hooking
            );

            _resizeHookSetup = true;
        }
示例#2
0
 public static extern IntPtr SetWinEventHook(uint eventMin, uint eventMax, IntPtr hmodWinEventProc, WindowEventHooks.WinEventDelegate lpfnWinEventProc, uint idProcess, uint idThread, uint dwFlags);