Exemplo n.º 1
0
        private IntPtr HwndHook(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
        {
            const int WM_HOTKEY = 0x0312;

            switch (msg)
            {
            case WM_HOTKEY:
                switch (wParam.ToInt32())
                {
                case 9001:
                    Snipper.Snip();
                    break;

                case 9002:
                    Window haru = Application.Current.Windows.OfType <Window>().Where(x => x.Name == "windowHaru").FirstOrDefault();
                    if (haru == null)
                    {
                        new FormHaru().Show();
                    }
                    else
                    {
                        haru.Close();
                    }
                    break;

                case 9003:
                    new FormDebug().Show();
                    break;
                }
                break;
            }
            return(IntPtr.Zero);
        }
Exemplo n.º 2
0
 public static void Snip()
 {
     if (snipper == null)
     {
         snipper         = new Snipper();
         snipper.Closed += delegate { snipper = null; };
         snipper.ShowDialog();
     }
 }