#1042367 - Banner fixed for bug 1022399 now hangs, code simplified on banner destroy

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@3697 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
ramon18 2004-10-10 00:53:04 +00:00
parent ca1929afb7
commit 7cf2ae3160
2 changed files with 21 additions and 13 deletions

View file

@ -73,19 +73,17 @@ DWORD WINAPI BannerThread(LPVOID lpParameter)
return 0; return 0;
} }
SetForegroundWindow(lhwBanner);
while (IsWindow(lhwBanner)) while (IsWindow(lhwBanner))
{ {
if (PeekMessage(&msg, lhwBanner, 0, 0, PM_REMOVE)) if (PeekMessage(&msg, lhwBanner, 0, 0, PM_REMOVE))
{ {
DispatchMessage(&msg); DispatchMessage(&msg);
} }
else else
{ {
hwBanner = lhwBanner; hwBanner = lhwBanner;
WaitMessage(); WaitMessage();
} }
} }
hwBanner = NULL; hwBanner = NULL;
@ -99,6 +97,7 @@ void __declspec(dllexport) show(HWND hwndParent, int string_size, char *variable
{ {
DWORD dwThreadId; DWORD dwThreadId;
DWORD dwMainThreadId = GetCurrentThreadId();;
hwBanner = NULL; hwBanner = NULL;
@ -117,7 +116,14 @@ void __declspec(dllexport) show(HWND hwndParent, int string_size, char *variable
CloseHandle(hThread); CloseHandle(hThread);
ShowWindow(hwBanner, SW_SHOW); if (AttachThreadInput(dwMainThreadId, dwThreadId, TRUE))
{
// Activates and displays a window
ShowWindow(hwBanner, SW_SHOW);
AttachThreadInput(dwMainThreadId, dwThreadId, FALSE);
}
else
ShowWindow(hwBanner, SW_SHOW);
} }
} }
@ -134,6 +140,8 @@ void __declspec(dllexport) destroy(HWND hwndParent, int string_size, char *varia
PostMessage(hwBanner, WM_CLOSE, 0, 0); PostMessage(hwBanner, WM_CLOSE, 0, 0);
// The code below is not needed I think
/*
if (!hwndParent) if (!hwndParent)
{ {
// reset the thread that called banner::Show to be the foreground thread. // reset the thread that called banner::Show to be the foreground thread.
@ -158,7 +166,7 @@ void __declspec(dllexport) destroy(HWND hwndParent, int string_size, char *varia
SetForegroundWindow(hwTemp); SetForegroundWindow(hwTemp);
DestroyWindow(hwTemp); DestroyWindow(hwTemp);
} }
*/
// Wait for the thread to finish // Wait for the thread to finish
while (hwBanner) while (hwBanner)
Sleep(25); Sleep(25);

Binary file not shown.