[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - shell/source

Thomas Beck thomas.beck at cib.de
Mon Nov 27 21:30:43 UTC 2017


 shell/source/win32/SysShExec.cxx |   22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

New commits:
commit 21b490dbdfa2b7479b84dc7640ec239d6b700058
Author: Thomas Beck <thomas.beck at cib.de>
Date:   Wed May 3 12:57:11 2017 +0200

    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 at libreoffice.org>
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    (cherry picked from commit ad711bc6e2cc35c2ed114fff15008d5bbcfcf21c)
    Reviewed-on: https://gerrit.libreoffice.org/45369
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/shell/source/win32/SysShExec.cxx b/shell/source/win32/SysShExec.cxx
index 55cbb90a5782..70c694749b66 100644
--- a/shell/source/win32/SysShExec.cxx
+++ b/shell/source/win32/SysShExec.cxx
@@ -333,6 +333,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


More information about the Libreoffice-commits mailing list