public static extern bool SetWindowSubclass
 (
     this IntPtr hWnd,
     SUBCLASSPROC pfnSubclass,
     uint uIdSubclass,
     uint dwRefData
 );
Beispiel #2
0
        private void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            var windowInteropHelper = new WindowInteropHelper(this);
            var hWnd = windowInteropHelper.Handle;

            DisableWPFTabletSupport();

            RegisterTouchWindow(hWnd, 0x00000001 | TWF_WANTPALM);

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

            SetWindowSubclass(hWnd, _wndproc, IntPtr.Zero, IntPtr.Zero);
        }
        /// <summary>
        ///     Hooks into the stream of messages that are dispatched to the
        ///     specified window.
        /// </summary>
        /// <remarks>
        ///     The window must be owned by the calling thread.
        /// </remarks>
        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);
        }
        /// <summary>
        ///     Hooks into the stream of messages that are dispatched to the
        ///     specified window.
        /// </summary>
        /// <remarks>
        ///     The window must be owned by the calling thread.
        /// </remarks>
        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);
        }
Beispiel #5
0
 public static extern bool RemoveWindowSubclass(HWND hwnd, SUBCLASSPROC callback, IntPtr id);
Beispiel #6
0
 public static extern bool SetWindowSubclass(HWND hwnd, SUBCLASSPROC callback, IntPtr id, IntPtr data);
Beispiel #7
0
 public static extern bool GetWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, IntPtr uIdSubclass, ref IntPtr pdwRefData);
 public static extern bool SetWindowSubclass(HWND hwnd, SUBCLASSPROC callback, IntPtr id, IntPtr data);
 public static extern bool RemoveWindowSubclass(HWND hwnd, SUBCLASSPROC callback, IntPtr id);
 public static extern bool GetWindowSubclass(HWND hWnd, SUBCLASSPROC pfnSubclass, IntPtr uIdSubclass, ref IntPtr pdwRefData);
 public static extern bool SetWindowSubclass
 (
     this IntPtr hWnd,
     SUBCLASSPROC pfnSubclass,
     uint uIdSubclass,
     uint dwRefData
 );
Beispiel #12
0
 internal static extern bool SetWindowSubclass(IntPtr hWnd, SUBCLASSPROC pfnSubclass, uint uIdSubclass, IntPtr dwRefData);