From a4010c1d54bcc28a425c3dc3460cea0fd353dc32 Mon Sep 17 00:00:00 2001 From: kichik Date: Sun, 1 Feb 2009 12:35:28 +0000 Subject: [PATCH] a comment explaining foreground issues git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5916 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/Banner/Banner.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Contrib/Banner/Banner.c b/Contrib/Banner/Banner.c index a5498ee1..954e94ad 100644 --- a/Contrib/Banner/Banner.c +++ b/Contrib/Banner/Banner.c @@ -72,6 +72,19 @@ DWORD WINAPI BannerThread(LPVOID lpParameter) HWND hwndParent = (HWND) lpParameter; HWND lhwBanner; + // This right here is the mother of all evils when it comes to + // foreground windows. The dialog is created in another thread + // and there can only be one thread holding the right to set the + // foreground window. So long as this thread exists and has an + // active window, another thread from the same process can steal + // its thunder. But if the window and the thread are destroyed, + // the foreground rights pass on to another process. To avoid + // this situation that could cause the installer to show up on + // the background if Banner is used in .onInit, we don't let + // CreateDialog show the window and instead do this in the + // original thread. This is done by not specifying WS_VISIBLE + // for IDD_VERIFY. + lhwBanner = CreateDialog( GetModuleHandle(0), MAKEINTRESOURCE(IDD_VERIFY),