fixed bug #1743801 - Banner can hang when called form custom page

git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@5173 212acab6-be3b-0410-9dea-997c60f758d6
This commit is contained in:
kichik 2007-06-26 19:00:14 +00:00
parent 859235383b
commit a5b216a782

View file

@ -55,11 +55,24 @@ BOOL CALLBACK BannerProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
return 0; return 0;
} }
BOOL ProcessMessages()
{
BOOL processed = FALSE;
MSG msg;
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
{
DispatchMessage(&msg);
processed = TRUE;
}
return processed;
}
DWORD WINAPI BannerThread(LPVOID lpParameter) DWORD WINAPI BannerThread(LPVOID lpParameter)
{ {
HWND hwndParent = (HWND) lpParameter; HWND hwndParent = (HWND) lpParameter;
HWND lhwBanner; HWND lhwBanner;
MSG msg;
lhwBanner = CreateDialog( lhwBanner = CreateDialog(
GetModuleHandle(0), GetModuleHandle(0),
@ -75,11 +88,7 @@ DWORD WINAPI BannerThread(LPVOID lpParameter)
while (IsWindow(lhwBanner)) while (IsWindow(lhwBanner))
{ {
if (PeekMessage(&msg, lhwBanner, 0, 0, PM_REMOVE)) if (!ProcessMessages())
{
DispatchMessage(&msg);
}
else
{ {
hwBanner = lhwBanner; hwBanner = lhwBanner;
WaitMessage(); WaitMessage();
@ -111,6 +120,7 @@ void __declspec(dllexport) show(HWND hwndParent, int string_size, char *variable
// wait for the window to initalize and for the stack operations to finish // wait for the window to initalize and for the stack operations to finish
while (hThread && !hwBanner && !bFailed) while (hThread && !hwBanner && !bFailed)
{ {
ProcessMessages();
Sleep(10); Sleep(10);
} }
@ -142,7 +152,10 @@ void __declspec(dllexport) destroy(HWND hwndParent, int string_size, char *varia
// Wait for the thread to finish // Wait for the thread to finish
while (hwBanner) while (hwBanner)
{
ProcessMessages();
Sleep(25); Sleep(25);
}
} }
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)