コード例 #1
0
        private static int HookCallback(int code, IntPtr wParam, IntPtr lParam)
        {
            if (code == Win32.HCBT_ACTIVATE)
            {
                if (TestForDialog(wParam, "Run Report"))
                {
                    _dlgRunReport = new RunReportDialog();
                    _dlgRunReport.AssignHandle(wParam);
                }

                if (TestForDialog(wParam, "Reports"))
                {
                    _dlgReports = new ReportsDialog();
                    _dlgReports.AssignHandle(wParam);
                }
            }
            return(Win32.CallNextHookEx(_hHook, code, wParam, lParam));
        }
コード例 #2
0
        private static void Unhook()
        {
            if (_dlgRunReport != null)
            {
                _dlgRunReport.ReleaseHandle();
                _dlgRunReport = null;
            }

            if (_dlgReports != null)
            {
                _dlgReports.ReleaseHandle();
                _dlgReports = null;
            }

            if (_hHook != 0)
            {
                Win32.UnhookWindowsHookEx(_hHook);
                _hHook = 0;
            }
        }