summary refs log tree commit diff
path: root/third_party/SingleApplication-3.3.2/Windows.md
diff options
context:
space:
mode:
authorNicolas Werner <nicolas.werner@hotmail.de>2023-11-20 02:38:58 +0100
committerNicolas Werner <nicolas.werner@hotmail.de>2023-11-20 02:56:42 +0100
commit8ea03e41e063314ea712f4b81db80c2a4cd85c2d (patch)
tree8b4b37014345cd4004d525adb942c8675c8b2730 /third_party/SingleApplication-3.3.2/Windows.md
parentAutomatically increase database limits when hit (diff)
downloadnheko-8ea03e41e063314ea712f4b81db80c2a4cd85c2d.tar.xz
Switch to KDSingleApplication
Diffstat (limited to 'third_party/SingleApplication-3.3.2/Windows.md')
-rw-r--r--third_party/SingleApplication-3.3.2/Windows.md46
1 files changed, 0 insertions, 46 deletions
diff --git a/third_party/SingleApplication-3.3.2/Windows.md b/third_party/SingleApplication-3.3.2/Windows.md
deleted file mode 100644

index 13c52da0..00000000 --- a/third_party/SingleApplication-3.3.2/Windows.md +++ /dev/null
@@ -1,46 +0,0 @@ -Windows Specific Implementations -================================ - -Setting the foreground window ------------------------------ - -In the `instanceStarted()` example in the `README` we demonstrated how an -application can bring it's primary instance window whenever a second copy -of the application is started. - -On Windows the ability to bring the application windows to the foreground is -restricted, see [`AllowSetForegroundWindow()`][AllowSetForegroundWindow] for more -details. - -The background process (the primary instance) can bring its windows to the -foreground if it is allowed by the current foreground process (the secondary -instance). To bypass this `SingleApplication` must be initialized with the -`allowSecondary` parameter set to `true` and the `options` parameter must -include `Mode::SecondaryNotification`, See `SingleApplication::Mode` for more -details. - -Here is an example: - -```cpp -if( app.isSecondary() ) { - // This API requires LIBS += User32.lib to be added to the project - AllowSetForegroundWindow( DWORD( app.primaryPid() ) ); -} - -if( app.isPrimary() ) { - QObject::connect( - &app, - &SingleApplication::instanceStarted, - this, - &App::instanceStarted - ); -} -``` - -```cpp -void App::instanceStarted() { - QApplication::setActiveWindow( [window/widget to set to the foreground] ); -} -``` - -[AllowSetForegroundWindow]: https://msdn.microsoft.com/en-us/library/windows/desktop/ms632668.aspx