Пример #1
0
        void window_Loaded(object sender, RoutedEventArgs e)
        {
            WindowInteropHelper wih = new WindowInteropHelper(window);

            hWndSource       = HwndSource.FromHwnd(wih.Handle);
            clipboardWatcher = new ClipboardWatcher(hWndSource.Handle);
            clipboardWatcher.OnClipboardChanged += new EventHandler(ClipboardChanged);
            clipboardWatcher.SetClipboardHandle();
            hWndSource.AddHook(clipboardWatcher.ReceiveMessage);
            showHotKey = new GlobalHotkey(Modifiers.Win, Keys.Oemtilde, window, true);
            showHotKey.HotkeyPressed += new EventHandler <HotkeyEventArgs>(DoOnShowHotKey);
            if (Settings.Current.WasClosed)
            {
                window.Hide();
            }
        }