Example #1
0
        public void ApplyTo(Window applicationWindow)
        {
            var nativeWindow = new NativeApplicationWindow(applicationWindow);

            _systemMenu = NativeMethods.GetSystemMenu(nativeWindow.Handle, false);
            if (_options.Items.Any())
            {
                NativeMethods.InsertMenu(_systemMenu, -1, (uint)(MF.BYPOSITION | MF.SEPARATOR), UIntPtr.Zero, String.Empty);
            }
            foreach (var item in _options.Items)
            {
                var flags = MF.BYCOMMAND | MF.STRING;
                if (item.Checkable)
                {
                    flags |= MF.CHECKED;
                }
                NativeMethods.InsertMenu(_systemMenu, item.Id, (uint)flags, new UIntPtr((uint)item.Id), item.Header);
            }

            nativeWindow.AddHook(WndProc);
        }
Example #2
0
 public HotKeyService(IApplicationWindow applicationWindow)
 {
     _nativeApplicationWindow = new NativeApplicationWindow(applicationWindow);
     _nativeApplicationWindow.AddHook(WndProc);
 }