From 53c0880fc0affa37612be3bcc045566be63fe000 Mon Sep 17 00:00:00 2001 From: kichik Date: Fri, 5 Sep 2003 19:26:45 +0000 Subject: [PATCH] Reverting to old source code for now git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2845 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/Banner/Banner.c | 81 +++++++---------------------------------- 1 file changed, 13 insertions(+), 68 deletions(-) diff --git a/Contrib/Banner/Banner.c b/Contrib/Banner/Banner.c index d6c92b07..3f670ef6 100644 --- a/Contrib/Banner/Banner.c +++ b/Contrib/Banner/Banner.c @@ -14,101 +14,46 @@ HINSTANCE hInstance; HWND hwBanner; -HWND hwParent; char buf[1024]; unsigned int myatoi(char *s); -long oldProc; BOOL CALLBACK bannerProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { - if (hwndDlg == hwParent) - { - if (uMsg == WM_SIZE) - { - ShowWindow(hwBanner, wParam == SIZE_MINIMIZED ? SW_HIDE : SW_SHOW); - } - return CallWindowProc( - (WNDPROC) oldProc, - hwndDlg, - uMsg, - wParam, - lParam - ); - } if (uMsg == WM_INITDIALOG) { popstring(buf); - while (*(int*)buf == CHAR4_TO_DWORD('/','s','e','t')) - { + while (*(int*)buf == CHAR4_TO_DWORD('/','s','e','t')) { unsigned int id; - popstring(buf); id = myatoi(buf); - popstring(buf); - SetDlgItemText(hwndDlg, id, buf); - + SetDlgItemText(hwndDlg,id,buf); popstring(buf); } - SetWindowText(hwndDlg, buf); - SetDlgItemText(hwndDlg, IDC_STR, buf); + SetWindowText(hwndDlg,buf); + SetDlgItemText(hwndDlg,IDC_STR,buf); + ShowWindow(hwndDlg,SW_SHOW); } - if (uMsg == WM_CLOSE) - { - hwBanner = 0; - DestroyWindow(hwndDlg); - } - return 0; -} - -DWORD WINAPI BannerCreator(void *lpParameter) -{ - oldProc = SetWindowLong((HWND) lpParameter, GWL_WNDPROC, (long)bannerProc); - - hwParent = (HWND) lpParameter; - - hwBanner = CreateDialog( - GetModuleHandle(0), - MAKEINTRESOURCE(IDD_VERIFY), - (HWND) lpParameter, - bannerProc - ); - - { - BOOL bRet; - MSG msg; - - while (hwBanner && (bRet = GetMessage(&msg, NULL, 0, 0))) - { - if (bRet != -1) - { - TranslateMessage(&msg); - DispatchMessage(&msg); - } - } - } - return 0; } void __declspec(dllexport) show(HWND hwndParent, int string_size, char *variables, stack_t **stacktop) { - DWORD dwThreadId; + EXDLL_INIT(); - g_stringsize = string_size; - g_stacktop = stacktop; - - CreateThread(0, 0, BannerCreator, (void *) hwndParent, 0, &dwThreadId); + hwBanner = CreateDialog( + GetModuleHandle(0), + MAKEINTRESOURCE(IDD_VERIFY), + hwndParent, + bannerProc + ); } void __declspec(dllexport) destroy(HWND hwndParent, int string_size, char *variables, stack_t **stacktop) { - if (oldProc) - SetWindowLong(hwndParent, GWL_WNDPROC, oldProc); - - SendMessage(hwBanner, WM_CLOSE, 0, 0); + DestroyWindow(hwBanner); } BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)