protected override void OnStart() { msgID_Shell_HookReplaced = NativeMethods.RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_SHELL_REPLACED"); msgID_Shell_ActivateShellWindow = NativeMethods.RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HSHELL_ACTIVATESHELLWINDOW"); msgID_Shell_GetMinRect = NativeMethods.RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HSHELL_GETMINRECT"); msgID_Shell_Language = NativeMethods.RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HSHELL_LANGUAGE"); msgID_Shell_Redraw = NativeMethods.RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HSHELL_REDRAW"); msgID_Shell_Taskman = NativeMethods.RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HSHELL_TASKMAN"); msgID_Shell_WindowActivated = NativeMethods.RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HSHELL_WINDOWACTIVATED"); msgID_Shell_WindowCreated = NativeMethods.RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HSHELL_WINDOWCREATED"); msgID_Shell_WindowDestroyed = NativeMethods.RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HSHELL_WINDOWDESTROYED"); if (Environment.OSVersion.Version.Major >= 6) { NativeMethods.ChangeWindowMessageFilter(msgID_Shell_HookReplaced, NativeConstants.MSGFLT_ADD); NativeMethods.ChangeWindowMessageFilter(msgID_Shell_ActivateShellWindow, NativeConstants.MSGFLT_ADD); NativeMethods.ChangeWindowMessageFilter(msgID_Shell_GetMinRect, NativeConstants.MSGFLT_ADD); NativeMethods.ChangeWindowMessageFilter(msgID_Shell_Language, NativeConstants.MSGFLT_ADD); NativeMethods.ChangeWindowMessageFilter(msgID_Shell_Redraw, NativeConstants.MSGFLT_ADD); NativeMethods.ChangeWindowMessageFilter(msgID_Shell_Taskman, NativeConstants.MSGFLT_ADD); NativeMethods.ChangeWindowMessageFilter(msgID_Shell_WindowActivated, NativeConstants.MSGFLT_ADD); NativeMethods.ChangeWindowMessageFilter(msgID_Shell_WindowCreated, NativeConstants.MSGFLT_ADD); NativeMethods.ChangeWindowMessageFilter(msgID_Shell_WindowDestroyed, NativeConstants.MSGFLT_ADD); } NativeHookMethods.InitializeShellHook(0, handle); }
protected override void OnStart() { _msgIdShellWindowCreated = RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HSHELL_WINDOWCREATED"); _msgIdShellWindowDestroyed = RegisterWindowMessage("SMART_SYSTEM_MENU_HOOK_HSHELL_WINDOWDESTROYED"); if (Environment.OSVersion.Version.Major >= 6) { ChangeWindowMessageFilter(_msgIdShellWindowCreated, Constants.MSGFLT_ADD); ChangeWindowMessageFilter(_msgIdShellWindowDestroyed, Constants.MSGFLT_ADD); } NativeHookMethods.InitializeShellHook(0, _handle, _dragByMouseMenuItem); }