Exemple #1
0
        public override void ActivateForm(Form form, DesktopWindow window, IntPtr hwnd)
        {
            if (window == null || window.Handle != form.Handle)
            {
                //Log.InfoFormat("[{0}] Activating Main Window - current=({1})", hwnd, window != null ? window.Exe : "?");

                // bring to top
                form.TopMost = true;
                form.TopMost = false;

                // set as active form in task bar
                form.Activate();

                // stop flashing...happens occassionally when switching quickly when activate manuver is fails
                NativeMethods.FlashWindow(form.Handle, NativeMethods.FLASHW_STOP);
            }
        }
Exemple #2
0
        public override void ActivateForm(Form form, DesktopWindow window, IntPtr hwnd)
        {
            if (window == null || window.Handle != form.Handle)
            {
                //Log.InfoFormat("[{0}] Activating Main Window - current=({1})", hwnd, window != null ? window.Exe : "?");

                // Send press of Alt key so that the main window can be activated w/o user interaction
                NativeMethods.keybd_event(VK_MENU, 0xb8, 0, 0);
                // Activate main window
                form.Activate();
                // Release Alt key
                NativeMethods.keybd_event(VK_MENU, 0xb8, KEYEVENTF_KEYUP, 0);

                // Set foreground back to terminal window
                //NativeMethods.SetForegroundWindow(hwnd);
            }
        }
Exemple #3
0
        public override void ActivateForm(Form form, DesktopWindow window, IntPtr hwnd)
        {
            if (window == null || window.Handle != form.Handle)
            {
                //Log.InfoFormat("[{0}] Activating Main Window - current=({1})", hwnd, window != null ? window.Exe : "?");

                IntPtr Dummy = IntPtr.Zero;

                IntPtr hWnd = form.Handle;
                if (NativeMethods.IsIconic(hWnd))
                {
                    NativeMethods.ShowWindowAsync(hWnd, SW_RESTORE);
                }
                else
                {
                    NativeMethods.ShowWindowAsync(hWnd, SW_SHOW);
                }
                NativeMethods.SetForegroundWindow(hWnd);

                NativeMethods.FlashWindow(form.Handle, NativeMethods.FLASHW_STOP);
            }
        }
Exemple #4
0
        //protected ILog Log { get { return LogManager.GetLogger(this.GetType()); } }

        public abstract void ActivateForm(Form form, DesktopWindow window, IntPtr hwnd);