Example #1
0
        static void hook_KeyPressed(object sender, KeyPressedEventArgs e)
        {
            IntPtr pWin = IntPtr.Zero;
            /*
            if (e.Key == Keys.Z && e.Modifier == (KBModifierKeys.Win | KBModifierKeys.Shift))
            {
                Debug.WriteLine("Got WinShiftZ");
                Point p = new Point();
                bool hr = GetCursorPos(out p);

                if (hr)
                {
                    Debug.WriteLine("Got Cursor Pos");
                    pWin = WindowFromPoint(p);
                    if (pWin == IntPtr.Zero)
                    {
                        Debug.WriteLine("WindowFromPoint Failed");
                        pWin = GetForegroundWindow();
                    }
                }
                else
                {
                    pWin = GetForegroundWindow();
                }

            }
            else
            {
                Debug.WriteLine("Got WinZ");
                pWin = GetForegroundWindow();
            }
            */

            pWin = GetForegroundWindow();

            if (pWin == IntPtr.Zero)
            {
                Debug.WriteLine("Bad Window - Not Adding");
                return;
            }

            string title = GetText(pWin);

            PreviewWindow win = new PreviewWindow(pWin);
            win.Disposed += new EventHandler(win_Disposed);

            MenuItem mi = new MenuItem();
            mi.Tag = win;
            mi.Text = "Window: " + title;
            mi.Click += new EventHandler(mi_Click);
            mnu.MenuItems.Add(0, mi);

            windows.AddLast(win);
            Debug.WriteLine("Adding Window... ");
            _sep.Visible = true;
        }
Example #2
0
 void hook_KeyPressed(object sender, KeyPressedEventArgs e)
 {
     //CreateAndShow(new IntPtr(0x000603C4));
     CreateAndShow(GetForegroundWindow());
 }
Example #3
0
 void hook_KeyPressed(object sender, KeyPressedEventArgs e)
 {
     //CreateAndShow(new IntPtr(0x000603C4));
     CreateAndShow(GetForegroundWindow());
 }