AdvancedLauncher.Tools.Win32.ComCtl32.WindowSubclass.WindowSubclass C# (CSharp) Method

WindowSubclass() public method

Hooks into the stream of messages that are dispatched to the specified window.
The window must be owned by the calling thread.
public WindowSubclass ( HWND hwnd ) : System
hwnd AdvancedLauncher.Tools.Win32.User32.HWND
return System
        public WindowSubclass(HWND hwnd)
        {
            if (!IsCorrectThread(hwnd)) {
                throw new InvalidOperationException("May not hook a window created by a different thread.");
            }

            _hwnd = hwnd;
            _wndproc = WndProcStub;
            _wndprocPtr = Marshal.GetFunctionPointerForDelegate(_wndproc);

            // Because our window proc is an instance method, it is connected
            // to this instance of WindowSubclass, where we can store state.
            // We do not need to store any extra state in native memory.
            NativeMethods.SetWindowSubclass(hwnd, _wndproc, IntPtr.Zero, IntPtr.Zero);
        }

Same methods

WindowSubclass::WindowSubclass ( ) : System