示例#1
0
        protected override void OnStart()
        {
            _msgIdCbtCreateWnd  = RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HCBT_CREATEWND");
            _msgIdCbtDestroyWnd = RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HCBT_DESTROYWND");
            _msgIdCbtMinMax     = RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HCBT_MINMAX");
            _msgIdCbtMoveSize   = RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HCBT_MOVESIZE");

            if (Environment.OSVersion.Version.Major >= 6)
            {
                ChangeWindowMessageFilter(_msgIdCbtCreateWnd, Constants.MSGFLT_ADD);
                ChangeWindowMessageFilter(_msgIdCbtDestroyWnd, Constants.MSGFLT_ADD);
                ChangeWindowMessageFilter(_msgIdCbtMinMax, Constants.MSGFLT_ADD);
                ChangeWindowMessageFilter(_msgIdCbtMoveSize, Constants.MSGFLT_ADD);
            }
            NativeHookMethods.InitializeCbtHook(0, _handle, _dragByMouseMenuItem);
        }
示例#2
0
        protected override void OnStart()
        {
            msgID_CBT_HookReplaced = NativeMethods.RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_CBT_REPLACED");
            msgID_CBT_Activate = NativeMethods.RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HCBT_ACTIVATE");
            msgID_CBT_CreateWnd = NativeMethods.RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HCBT_CREATEWND");
            msgID_CBT_DestroyWnd = NativeMethods.RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HCBT_DESTROYWND");
            msgID_CBT_MinMax = NativeMethods.RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HCBT_MINMAX");
            msgID_CBT_MoveSize = NativeMethods.RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HCBT_MOVESIZE");
            msgID_CBT_SetFocus = NativeMethods.RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HCBT_SETFOCUS");
            msgID_CBT_SysCommand = NativeMethods.RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HCBT_SYSCOMMAND");

            if (Environment.OSVersion.Version.Major >= 6)
            {
                NativeMethods.ChangeWindowMessageFilter(msgID_CBT_HookReplaced, NativeConstants.MSGFLT_ADD);
                NativeMethods.ChangeWindowMessageFilter(msgID_CBT_Activate, NativeConstants.MSGFLT_ADD);
                NativeMethods.ChangeWindowMessageFilter(msgID_CBT_CreateWnd, NativeConstants.MSGFLT_ADD);
                NativeMethods.ChangeWindowMessageFilter(msgID_CBT_DestroyWnd, NativeConstants.MSGFLT_ADD);
                NativeMethods.ChangeWindowMessageFilter(msgID_CBT_MinMax, NativeConstants.MSGFLT_ADD);
                NativeMethods.ChangeWindowMessageFilter(msgID_CBT_MoveSize, NativeConstants.MSGFLT_ADD);
                NativeMethods.ChangeWindowMessageFilter(msgID_CBT_SetFocus, NativeConstants.MSGFLT_ADD);
                NativeMethods.ChangeWindowMessageFilter(msgID_CBT_SysCommand, NativeConstants.MSGFLT_ADD);
            }
            NativeHookMethods.InitializeCbtHook(0, handle);
        }