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:
parent
859235383b
commit
a5b216a782
1 changed files with 19 additions and 6 deletions
|
@ -55,11 +55,24 @@ BOOL CALLBACK BannerProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
|
|||
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)
|
||||
{
|
||||
HWND hwndParent = (HWND) lpParameter;
|
||||
HWND lhwBanner;
|
||||
MSG msg;
|
||||
|
||||
lhwBanner = CreateDialog(
|
||||
GetModuleHandle(0),
|
||||
|
@ -75,11 +88,7 @@ DWORD WINAPI BannerThread(LPVOID lpParameter)
|
|||
|
||||
while (IsWindow(lhwBanner))
|
||||
{
|
||||
if (PeekMessage(&msg, lhwBanner, 0, 0, PM_REMOVE))
|
||||
{
|
||||
DispatchMessage(&msg);
|
||||
}
|
||||
else
|
||||
if (!ProcessMessages())
|
||||
{
|
||||
hwBanner = lhwBanner;
|
||||
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
|
||||
while (hThread && !hwBanner && !bFailed)
|
||||
{
|
||||
ProcessMessages();
|
||||
Sleep(10);
|
||||
}
|
||||
|
||||
|
@ -142,7 +152,10 @@ void __declspec(dllexport) destroy(HWND hwndParent, int string_size, char *varia
|
|||
|
||||
// Wait for the thread to finish
|
||||
while (hwBanner)
|
||||
{
|
||||
ProcessMessages();
|
||||
Sleep(25);
|
||||
}
|
||||
}
|
||||
|
||||
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue