mirror of
https://github.com/rustdesk/rustdesk.git
synced 2026-10-19 16:17:03 +00:00
fix(windows): allow existing session to foreground (#16349)
Signed-off-by: TayfurYldz <238304586+TayfurYldz@users.noreply.github.com> Co-authored-by: TayfurYldz <238304586+TayfurYldz@users.noreply.github.com>
This commit is contained in:
co-authored by
TayfurYldz
parent
08affc69c4
commit
17feabbcab
@@ -104,6 +104,14 @@ int APIENTRY wWinMain(_In_ HINSTANCE instance, _In_opt_ HINSTANCE prev,
|
||||
}
|
||||
if (!allow_multiple_instances) {
|
||||
if (!command_line_arguments.empty()) {
|
||||
// The process launched by the browser owns the foreground permission.
|
||||
// Transfer it to the existing RustDesk process before dispatching the
|
||||
// URI so that it can bring an existing session to the foreground.
|
||||
DWORD pid = 0;
|
||||
::GetWindowThreadProcessId(hwnd, &pid);
|
||||
if (pid != 0) {
|
||||
::AllowSetForegroundWindow(pid);
|
||||
}
|
||||
// Dispatch command line arguments
|
||||
DispatchToUniLinksDesktop(hwnd);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user