From ca8fbc5bec10d23a4668e7b0140a8ace61ff1857 Mon Sep 17 00:00:00 2001 From: kichik Date: Mon, 27 Jan 2003 15:44:13 +0000 Subject: [PATCH] Banner now "works" with the MUI too git-svn-id: https://svn.code.sf.net/p/nsis/code/NSIS/trunk@2083 212acab6-be3b-0410-9dea-997c60f758d6 --- Contrib/Banner/Banner.c | 35 +++++++++++++++++++++++++++++++++++ Contrib/Banner/Banner.dsp | 2 +- Contrib/Banner/Example.nsi | 2 ++ Contrib/Banner/Readme.txt | 12 +++++++++++- Plugins/Banner.dll | Bin 2560 -> 2560 bytes 5 files changed, 49 insertions(+), 2 deletions(-) diff --git a/Contrib/Banner/Banner.c b/Contrib/Banner/Banner.c index 1dd4fd08..3eb3dedf 100644 --- a/Contrib/Banner/Banner.c +++ b/Contrib/Banner/Banner.c @@ -2,16 +2,36 @@ #include "../exdll/exdll.h" #include "../../Source/exehead/resource.h" +// Turn a pair of chars into a word +// Turn four chars into a dword +#ifdef __BIG_ENDIAN__ // Not very likely, but, still... +#define CHAR2_TO_WORD(a,b) (((WORD)(b))|((a)<<8)) +#define CHAR4_TO_DWORD(a,b,c,d) (((DWORD)CHAR2_TO_WORD(c,d))|(CHAR2_TO_WORD(a,b)<<16)) +#else +#define CHAR2_TO_WORD(a,b) (((WORD)(a))|((b)<<8)) +#define CHAR4_TO_DWORD(a,b,c,d) (((DWORD)CHAR2_TO_WORD(a,b))|(CHAR2_TO_WORD(c,d)<<16)) +#endif + HINSTANCE hInstance; HWND hwBanner; char buf[1024]; +unsigned int myatoi(char *s); + BOOL CALLBACK bannerProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) { if (uMsg == WM_INITDIALOG) { popstring(buf); + while (*(int*)buf == CHAR4_TO_DWORD('/','s','e','t')) { + unsigned int id; + popstring(buf); + id = myatoi(buf); + popstring(buf); + SetDlgItemText(hwndDlg,id,buf); + popstring(buf); + } SetWindowText(hwndDlg,buf); SetDlgItemText(hwndDlg,IDC_STR,buf); } @@ -38,4 +58,19 @@ void __declspec(dllexport) destroy(HWND hwndParent, int string_size, char *varia BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) { return TRUE; +} + +unsigned int myatoi(char *s) +{ + unsigned int v=0; + + for (;;) + { + unsigned int c=*s++; + if (c >= '0' && c <= '9') c-='0'; + else break; + v*=10; + v+=c; + } + return v; } \ No newline at end of file diff --git a/Contrib/Banner/Banner.dsp b/Contrib/Banner/Banner.dsp index 182c08bb..84b7ff41 100644 --- a/Contrib/Banner/Banner.dsp +++ b/Contrib/Banner/Banner.dsp @@ -54,7 +54,7 @@ BSC32=bscmake.exe # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 -# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /entry:"_DllMainCRTStartup" /dll /machine:I386 /nodefaultlib /out:"../../Plugins/Banner.dll" /opt:nowin98 +# ADD LINK32 kernel32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib /nologo /entry:"_DllMainCRTStartup" /dll /machine:I386 /nodefaultlib /out:"../../Plugins/Banner.dll" /opt:nowin98 # SUBTRACT LINK32 /pdb:none !ELSEIF "$(CFG)" == "Banner - Win32 Debug" diff --git a/Contrib/Banner/Example.nsi b/Contrib/Banner/Example.nsi index bc4f47c5..f360eb65 100644 --- a/Contrib/Banner/Example.nsi +++ b/Contrib/Banner/Example.nsi @@ -1,3 +1,5 @@ +# Look at Readme.txt for usage alongside with the Modern UI + Name "Banner.dll test" OutFile "Banner Test.exe" diff --git a/Contrib/Banner/Readme.txt b/Contrib/Banner/Readme.txt index 78330e0e..419f75eb 100644 --- a/Contrib/Banner/Readme.txt +++ b/Contrib/Banner/Readme.txt @@ -1,9 +1,19 @@ Banner.dll shows a banner with customizable text. -There are only two functions, show and destory. Show must be called +There are only two functions, show and destroy. Show must be called with the /NOUNLOAD flag or else it won't work. Show takes one argument which is the text to show and destroy takes no arguments. +To use with the MUI use: + +Banner::show /NOUNLOAD /set 76 "text to replace Please wait while Setup is loading..." "other text as normal" + +You can use multiple /SETs to change the text of multiple labels. For example: + +Banner::show /NOUNLOAD /set 76 "bah #1" /set 54 "bah #2" "other text as normal" + +The second parameter for /set is the ID of the control that its text should be replaced in the dialog. + Look at Example.nsi for an example. Created by Amir Szekely (aka KiCHiK) \ No newline at end of file diff --git a/Plugins/Banner.dll b/Plugins/Banner.dll index 79948408f1aed46e9d69bd297dd32238023bc9a8..f4f12104ad4998569030e434937d2b20964c7467 100644 GIT binary patch delta 329 zcmZn=X%LxkL9x%@)Q$lP9x(7Jax=0qFfaiHxFCXGCw{DE)R~;fWHNanqdJo$Yz#y<+zc{tzwb~08plH~OV<58A zMMdR>36Rx%geUBOiHc0<|I1-7lz{@4wjeVi!%8lM{udPh>JH0bV_{$b%E!mWMjIbE zB*3tc1*jsd^+1Vcw?XT-66IbumVp10eOZd-xk9z} zhSigO*|)3d0NuoAAa4+45Nl9k&}%T+V4lGygY5=K3@#d6H@Ii;*x;4H2ZPOq9OoG) H8n6QZ=HF>> delta 212 zcmZn=X%LxkL9yTAp)CUxJYe8ceK76t|&U*Nx}0FWOyIgh1x za}tvS<0Q5NlP|Fe3AQl>r