Exemplo n.º 1
0
        public static void ActivateTaskbar()
        {
            var taskBarHandle = WinAPIHelper.FindWindow("Shell_traywnd", "");

            WinAPIHelper.ShowWindow(taskBarHandle, WindowShowStyle.Show);
            uint lpdwProcessId;

            WinAPIHelper.AttachThreadInput(WinAPIHelper.GetCurrentThreadId(), WinAPIHelper.GetWindowThreadProcessId(WinAPIHelper.GetForegroundWindow(), out lpdwProcessId), true);
            WinAPIHelper.SetForegroundWindow(taskBarHandle);
            WinAPIHelper.AttachThreadInput(WinAPIHelper.GetCurrentThreadId(), WinAPIHelper.GetWindowThreadProcessId(WinAPIHelper.GetForegroundWindow(), out lpdwProcessId), false);
        }
Exemplo n.º 2
0
        public static void ActivatePowerPoint(Application powerPoint)
        {
            if (powerPoint == null)
            {
                return;
            }
            var powerPointHandle = new IntPtr(powerPoint.HWND);

            WinAPIHelper.ShowWindow(powerPointHandle, WindowShowStyle.ShowMaximized);
            uint lpdwProcessId;

            WinAPIHelper.AttachThreadInput(WinAPIHelper.GetCurrentThreadId(), WinAPIHelper.GetWindowThreadProcessId(WinAPIHelper.GetForegroundWindow(), out lpdwProcessId), true);
            WinAPIHelper.SetForegroundWindow(powerPointHandle);
            WinAPIHelper.AttachThreadInput(WinAPIHelper.GetCurrentThreadId(), WinAPIHelper.GetWindowThreadProcessId(WinAPIHelper.GetForegroundWindow(), out lpdwProcessId), false);
        }
Exemplo n.º 3
0
        public static void ActivateForm(IntPtr handle, bool maximized, bool topMost)
        {
            WinAPIHelper.ShowWindow(handle, maximized ? WindowShowStyle.ShowMaximized : WindowShowStyle.ShowNormal);
            uint lpdwProcessId;

            WinAPIHelper.AttachThreadInput(WinAPIHelper.GetCurrentThreadId(), WinAPIHelper.GetWindowThreadProcessId(WinAPIHelper.GetForegroundWindow(), out lpdwProcessId), true);
            WinAPIHelper.SetForegroundWindow(handle);
            WinAPIHelper.AttachThreadInput(WinAPIHelper.GetCurrentThreadId(), WinAPIHelper.GetWindowThreadProcessId(WinAPIHelper.GetForegroundWindow(), out lpdwProcessId), false);
            if (topMost)
            {
                WinAPIHelper.MakeTopMost(handle);
            }
            else
            {
                WinAPIHelper.MakeNormal(handle);
            }
        }