summaryrefslogtreecommitdiff
path: root/shell
diff options
context:
space:
mode:
authorThomas Beck <thomas.beck@cib.de>2017-05-03 12:57:11 +0200
committerAndras Timar <andras.timar@collabora.com>2017-05-18 15:39:01 +0200
commit0dd7d7dd6868d0da8649a1db89fbda24866f4400 (patch)
tree2991e210a6ef2cabd5b10e5dd7bac4e66e5a68d1 /shell
parent25dd6bdca2ba08c3fdd90790df067db829231867 (diff)
tdf#107587 Opening Hyperlink opens Browser in Background.
Added neccessary WinAPI calls to bring called window into the Foreground. Change-Id: I080968f655e2230d1a514b3ef91bf916d904d844 Reviewed-on: https://gerrit.libreoffice.org/37196 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> (cherry picked from commit ad711bc6e2cc35c2ed114fff15008d5bbcfcf21c) Reviewed-on: https://gerrit.libreoffice.org/37266 Reviewed-by: Miklos Vajna <vmiklos@collabora.co.uk> (cherry picked from commit 45b2e11a6756ed322cda932142c31366fc2b6da6)
Diffstat (limited to 'shell')
-rw-r--r--shell/source/win32/SysShExec.cxx22
1 files changed, 22 insertions, 0 deletions
diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx
index c69d3f2a0c59..6cb31942ba02 100644
--- a/shell/source/win32/SysShExec.cxx
+++ b/shell/source/win32/SysShExec.cxx
@@ -323,6 +323,28 @@ void SAL_CALL CSysShExec::execute( const OUString& aCommand, const OUString& aPa
static_cast< XSystemShellExecute* >(this),
psxErr);
}
+ else
+ {
+ // Get Permission make changes to the Window of the created Process
+ HWND procHandle = 0;
+ DWORD procId = GetProcessId(sei.hProcess);
+ AllowSetForegroundWindow(procId);
+
+ // Get the handle of the created Window
+ DWORD check = 0;
+ GetWindowThreadProcessId(procHandle, &check);
+ SAL_WARN_IF(check != procId, "shell", "Could not get handle of process called by shell.");
+
+ // Move created Window into the foreground
+ if(procHandle != 0)
+ {
+ SetForegroundWindow(procHandle);
+ SetActiveWindow(procHandle);
+ }
+ }
+
+ // Close the handle for the created childprocess when we are done
+ CloseHandle(sei.hProcess);
}
// XServiceInfo