コード例 #1
0
 private void UnHookControls()
 {
     foreach (IntPtr hWnd in m_WndProcMap.Keys)
     {
         WinAPI.SetWindowLongPtr(hWnd
                                 , Constants.GWL_WNDPROC
                                 , m_WndProcMap[hWnd]
                                 );
     }
 }
コード例 #2
0
        private void HookChildControl(Control ctrl)
        {
            if (WinAPI.IsWindow(ctrl.Handle))
            {
                m_WndProcMap[ctrl.Handle]
                    = WinAPI.GetWindowLongPtr(ctrl.Handle, Constants.GWL_WNDPROC);

                WinAPI.SetWindowLongPtr(ctrl.Handle
                                        , Constants.GWL_WNDPROC
                                        , Marshal.GetFunctionPointerForDelegate(m_CtrlWndProcDelegate)
                                        );
            }

            if (!ctrl.HasChildren)
            {
                return;
            }
            foreach (Control child in ctrl.Controls)
            {
                HookChildControl(child);
            }
        }